Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
skipping steps on a KornShell script
Name: Cristina Date: July 18, 2002 at 07:27:56 Pacific
Comment:
Does exist in kornshell a command like DOS "goto" to skip some steps and go to a determinated place on a script? Could somebody tell me if there's way with if then sentences to do that (for exemple if [ $var1 = 1 ] then echo "step will be skipped" goto "there" fi
Name: Don Arnett Date: July 18, 2002 at 08:15:52 Pacific
Reply:
Check out http://www.kornshell.com/
I looked thru the Korn 93 manual and did not see a goto command listed.
In school, most programmers are trained not to use goto as it leads to bad programming practices.
Most (99.999%), if not all, code can be coded without any gotos.
If you need some help with that, post some code.
0
Response Number 2
Name: LANkrypt0 Date: July 18, 2002 at 14:04:40 Pacific
Reply:
My Suggestion: Make all of your chunks of code functions, and then you can call those functions. (i.e):
#!/bin/ksh stty erase ^? function echoyes { echo "yes" } function echono { echo "no" } echo "Do you like monkeys?" read answer case $answer in y*|Y*) echoyes ;; n*|N*) echono ;; *) ksh testscript ;; esac
NOTE: Anything can go between the { }'s for functions, and then you can call those anytime during the regular routine of your script. The functions will act as mini-programs themselves. So you can have hundreds or "mini-programs" within your main program.
Hope this helps, any other questions, feel free to ask.
Summary: I need a KornShell script that will, among all the users currently logged on to the system, find a slot of one hour that contains the most number of users. I know how to list all the users currently l...
Summary: I need to create a kornshell script that include ftp commands . I already created this shell but I'm not able to check if the ftp finish well or not . Any suggestion will be very apreciates . Thanks ...
Summary: Hi all, What I need to do is very simple :) I just need to run a script every hour to check on a certain directory on the HP-UX server we have e.g. /tmp/tools to know what are the new files created in...