while getopts hva: op; do
case $op in
h)
echo 'luther.gliethttp test'
;;
v)
echo 'v1.0-2008.12.27'
;;
a)
echo "args=$OPTARG"
;;
esac
done
shift `expr $OPTIND - 1`
echo $@
./run.sh -h -v -a 12,5,luther.gliethttp 1 2 3 4 5
luther.gliethttp test
v1.0-2008.12.27
args=12,5,luther.gliethttp
1 2 3 4 5
其中getopts,$OPTARG和$OPTIND都是系统内置函数和变量
阅读(3253) | 评论(0) | 转发(0) |