LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-26-2003, 06:38 PM   #1
batfoot
LQ Newbie
 
Registered: Aug 2003
Posts: 2

Rep: Reputation: 0
Goto command?


Hello,

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.


Thanks
Justin
 
Old 08-26-2003, 06:47 PM   #2
GŠutama
Member
 
Registered: Jun 2003
Location: Tokyo
Distribution: Gentoo
Posts: 78

Rep: Reputation: 15
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.
 
Old 08-26-2003, 06:53 PM   #3
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
lol

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)

#!/bin/sh

function whatever ()
{
place what function should do
}
code
code
code
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))
 
Old 08-26-2003, 07:04 PM   #4
batfoot
LQ Newbie
 
Registered: Aug 2003
Posts: 2

Original Poster
Rep: Reputation: 0
hi,

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?

thanks
Justin
 
Old 08-26-2003, 07:17 PM   #5
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
mount /dev/whatever
if [ -e /path/filename ]; then
echo "File found!"
else
echo "File nto found"
fi
umount /dev/whatever

that might help
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH goto dkrysak Programming 35 03-21-2013 10:22 AM
goto/label command for scripting in bash shell terry.trent Linux - Software 3 07-09-2010 10:15 AM
can you use goto in bash script sabliny Programming 3 10-07-2005 05:54 PM
goto usage bru Programming 5 03-09-2004 03:44 AM
GOTO function in bash? sobchak Programming 1 07-22-2002 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration