bash script command
i m sorry maybe this is irrelevant with this milis but i new in linux in past i ussualy use batch file now i try to use shell script i got problem in batch file i ussualy use @echo off some command some command goto end :end some command --- what is replacement goto end and :end in bash script i've tried function(), but that is not excatly what i want i need command that jump to another part of that script sorry for my bad english (i am indonesian) and thanx for your attention -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: bash script command
On Thu, Aug 28, 2008 at 10:39 AM, arsyante [EMAIL PROTECTED] wrote: i m sorry maybe this is irrelevant with this milis but i new in linux in past i ussualy use batch file now i try to use shell script i got problem in batch file i ussualy use @echo off some command some command goto end :end some command --- what is replacement goto end and :end in bash script i've tried function(), but that is not excatly what i want i need command that jump to another part of that script There are no labels and jumps in shell. The best you can do is use conditionals. foo() { commands } bar() { commands } if [ $somecondition = 1 ]; then foo else bar fi Here is some good documentation on bash (which is probably the shell you're using): http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html http://tldp.org/LDP/abs/html/ -- Dan -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: bash script command
arsyante wrote: what is replacement goto end and :end in bash script i've tried function(), but that is not excatly what i want i need command that jump to another part of that script As Dan already pointed out, there are no direct replacements for labels and goto. However, I think that you will find functions and conditional statements much more powerful than the goto command once you use them a few times. Here is your example.bat in example.sh: = #!/bin/sh # Begin /home/dj/bin/example.sh # this is a function for the label you used above end(){ some ending command # the exit command takes an optional return # value to pass back to the shell errorlevel # in DOS is $? in shell (the return vlaue) exit 0 } # This is where your script actually starts some command some command # if the previous command was successful then end # or continue on to the next command if [ $? == 0 ] then end fi another command another command end # End /home/dj/bin/example.sh = Feel free to throw a couple more small examples this way if you need more help with it. -- DJ Lucas -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page