14 lines
282 B
Bash
14 lines
282 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
# simple demonstration of the getopts command
|
||
|
|
||
|
while getopts :ab:c opt
|
||
|
do
|
||
|
case "$opt" in
|
||
|
a) echo "Found the -a option" ;;
|
||
|
b) echo "Found the -b option, with value $OPTARG" ;;
|
||
|
c) echo "Found the -c option" ;;
|
||
|
*) echo "Unknown option:$opt" ;;
|
||
|
esac
|
||
|
done
|