I do admit I extracted the first example from a larger script of mine, and the second example came from the Stack Overflow link you linked.
I'll fix the problems you pointed out, thanks for letting me know about them. It's why I have the disclaimer at the end.
Regarding the --longoptions comment though, GNU getopt does have such an option. It's the version I used in the first example.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I do admit I extracted the first example from a larger script of mine, and the second example came from the Stack Overflow link you linked.
I'll fix the problems you pointed out, thanks for letting me know about them. It's why I have the disclaimer at the end.
Regarding the --longoptions comment though, GNU getopt does have such an option. It's the version I used in the first example.