Sample code using getopt
while getopts :f:cuh OP
do
case ${OP} in
f) SERVERS=${OPTARG}
;;
c) if [ "${SERVERS}" != "false" ]
then
check
else
usage
fi
;;
u) if [ "${SERVERS}" != "false" ]
then
cd ${BASE}
fi
;;
*|h)
usage
;;
esac
done
No comments:
Post a Comment