How To Use Getopts To Parse Linux Shell Script Options
Introducing the getopts builtin Passing values into a Bash script is pretty a pretty simple matter. You call your script from the command line or from another script and provide your list of values behind the script name. These values can be accessed inside your script as variables, starting with $1 for the first variable, $2 for the second and so on. But if you want to pass options to a script, the situation quickly becomes more complex....