Shell Scripting getopts options
The getopts options are used in shell scripts to parse arguments passed to them. When arguments are passed on the command line, getopts parse those arguments instead of command lines.
Options are written starting with a hyphen (-), followed by the letter. For example, -a, -b, -c, -d, etc.
Example 1 without argument:
Look at the above snapshot, we have created three options -a, -b and-c. And no arguments are required for any option.
Look at the above snapshot, this is the sample output from the above script.
Example 2 with argument:
Look at the above snapshot, argument is required with option b.
Look at the above snapshot, this is the sample output of above script.
Next Topicif then else