Types:
Command line options can be classified into 3 types:
- Options which does not take arguments:
- ls -l #no arg for -l
- Options which take arguments:
- cut -d"," file #arg "," for -d
- Options + Additional command line arguments:
- ls -l file1 file2 file3
The syntax of the getopts command is:
getopts optstring name-> optstring - the string which contains the list of options expected in the command line
-> name - the variable name which is used to read the command line options one by one.