linuxbashshellgoto

Is there a "goto" statement in bash?


Is there a "goto" statement in Bash?

I know it is considered bad practice, but I need specifically a "goto".


Solution

  • 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 break and continue, which aren't as flexible as goto, but are more flexible in Bash than in some languages, and may help you achieve what you want. (Whatever it is that you want . . .)