Category: 2. Shell Getopts
-
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.
-
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…