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