I downloaded a script the other day and I was immediately drawn to a new bash function (to me),
getopts. It was so clean, clear and concise that I immediately wanted to start using it in my bash scripts.
First of all, what is
getopts? Here’s the function definition:
getopts processes command line arguments in a bash script using a while loop. Here’s an example:
For more info, have a look at this article.