LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   GOTO function in bash? (http://www.linuxquestions.org/questions/programming-9/goto-function-in-bash-26295/)

sobchak 07-22-2002 05:07 AM

GOTO function in bash?
 
Hello, I don't know hardly any bashscripting at all, so bear with me.

Is there an equivalent of the DOS function GOTO in bash? What I want is to put a "label" somewhere in the code, and be able to jump back to that location.

Example:

I have a command that exits with status 0, and if it does not, I want to run the program from the top again. I know how to write the if-statement, but not how to go back to a certain location in the code.

Any suggestions?

acid_kewpie 07-22-2002 05:10 AM

goto functions were banned in decent programming languages many years ago as they really don't make sense and can be lethal. make a function instead

function() {
script here
}

and call it in a conditional block


All times are GMT -5. The time now is 02:11 PM.