Your answer does not help me to understand how to use a "structured programming / if , while, for, functions" for the specific task that I want to achieve. I failed using "your" lovely structured programming and that's the reason why I'm asking for some hint to understand why and how I can use it. Your answer puts the finger on the spot and isn't helpful, also because it says things that I already knew.
On Tue, May 14, 2024 at 1:03 PM Greg Wooledge <g...@wooledge.org> wrote: > 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). > > -- Mario.