Absolute sleep
[mirrors/Programs.git] / bash / getopts.sh
1 #!/bin/sh
2
3 while getopts ":a:b:c:d:f" OPT; do
4 echo "$OPT ==> $OPTARG";
5 case $OPT in
6 a ) ahoj=$OPTARG;;
7
8 '?') echo "Unknown option: -$OPTARG" >&2; exit 1;;
9 ':') echo "Missing option argument for -$OPTARG" >&2; exit 2;;
10 * ) echo "Unimplemented option: -$OPT" >&2; exit 3;;
11 esac
12 done
13
14 echo
15 shift $(($OPTIND -1)); echo "Rest: $@";
16
17 : ${ahoj:=default}
18 echo ahoj: $ahoj
This page took 0.406739 seconds and 4 git commands to generate.