LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   can you use goto in bash script (https://www.linuxquestions.org/questions/programming-9/can-you-use-goto-in-bash-script-370767/)

sabliny 10-07-2005 05:44 PM

can you use goto in bash script
 
I am using Red Hat linux.

Can you use 'goto' in a bash script to jump to a label based on an if condition.


Thanks,

sabliny

nixcraft 10-07-2005 05:50 PM

Noop, use if command.

if [ condition ]; then
...
else
...
fi

acid_kewpie 10-07-2005 05:52 PM

goto's are a hideously awful way to program, you should use a function or a similar construct instead: http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-8.html

Tinkster 10-07-2005 05:54 PM

It is practically impossible to teach good programming style to
students that have had prior exposure to BASIC: as potential
programmers they are mentally mutilated beyond hope of
regeneration.
-- Dijkstra


Cheers,
Tink


All times are GMT -5. The time now is 06:50 AM.