On Tue, May 14, 2024 at 08:09:18AM +0200, Mario Marietto wrote: > Nobody can show a different way,a modern way, for creating my script ? Why > did I feel so comfortable by recreating the 1960s GOTO statement in Bash ?
I have absolutely no clue what you're trying to do or why you're trying to do it, but I *promise* you, whatever you think you're doing, you have NOT recreated a GOTO statement in bash. You showed a function. Functions can be called. This is NOT the same as issuing a GOTO command, because once the function returns, control flow resumes from the point where it was called. Bash (and sh, on which bash is based) explicitly chose not to have a GOTO statement in its language. The authors chose instead to use the control primitives that are collectively known as "structured programming" (if, while, for, functions).