日期:2014-05-16  浏览次数:20703 次

linux下shell管理9个以下参数选项

?

#!/bin/sh

#set var

ALL=false
HELP=false
FILE=false
CONFIG=0

while getopts ahf:c:  OPTION
do
	case $OPTION in
	a)ALL=true
	echo "ALLL is $ALL"
	;;
	h)HELP=true
	echo "HELP is $HELP"
	;;
	f)FILE=true
	echo "FILE is $FILE"
	;;
	c)CONFIG=$OPTARG
	echo "CONFIG is $CONFIG"
	;;
	\?)
	echo "good bye!"
	;;
	esac
done