Is there a "goto" statement in Bash?
I know it is considered bad practice, but I need specifically a "goto".
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is not; see §3.2.4 “Compound Commands” in the Bash Reference Manual for information about the control structures that do exist. In particular, note the mention of
breakandcontinue, which aren’t as flexible asgoto, but are more flexible in Bash than in some languages, and may help you achieve what you want. (Whatever it is that you want . . .)