Blokovani pres konstantu
[mirrors/Programs.git] / bash / getopts.sh
CommitLineData
21c4e167
H
1#!/bin/sh
2
b16422a7 3while getopts ":a:b:c:d:f" OPT; do
21c4e167 4 echo "$OPT ==> $OPTARG";
b16422a7
TM
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
21c4e167
H
12done
13
b16422a7 14echo
21c4e167 15shift $(($OPTIND -1)); echo "Rest: $@";
b16422a7
TM
16
17: ${ahoj:=default}
18echo ahoj: $ahoj
This page took 0.213762 seconds and 4 git commands to generate.