-   Linux - General (
-   -   Goto command? (

batfoot 08-26-2003 06:38 PM

Goto command?

I was wondering if someone could give me an example of an equivalent of a DOS goto command for a script I'm currently trying to write.


GŠutama 08-26-2003 06:47 PM

First you should't use the goto command. Personally I think that the code gets really messy. I try to solve the problems using if-else statements and method calls instead.

That is just my recommendation.

exodist 08-26-2003 06:53 PM


there is no goto it was removed because it is ugly, now it is a module system instead.. I am not completely sure how to utilise it though.. I was sent a script a little while ago and think I can demonstrate (I might be completely wrong)


function whatever ()
place what function should do
goto would be here saying goto :whatever
instead type whatever
then it calls function "whatever" and then returns here and moves down to the next line.
it would then be possible (I thinkt o tell it that if the funcion gave this do that (not sure how though))

batfoot 08-26-2003 07:04 PM


all i am trying to do is make my script jump up to a certain part in the script if the file i am looking for is not there. is there no simple way to make this happen?

i have a whole bunch of code that during the script, needs to mount the floppy drive, check to make sure my eula.txt is on there. if the file isn't on there, i have it write to the screen that the file isn't there, un-mount the floppy drive. What I want it to do here, is jump back up to the 'mount /mnt/floppy' line.

no easy way?


exodist 08-26-2003 07:17 PM

mount /dev/whatever
if [ -e /path/filename ]; then
echo "File found!"
echo "File nto found"
umount /dev/whatever

that might help

All times are GMT -5. The time now is 10:41 AM.