Skip to content

Instantly share code, notes, and snippets.

@likai24
Created June 26, 2016 06:04
Show Gist options
  • Save likai24/457e49ce0ae69d997206cbe8c31d8e01 to your computer and use it in GitHub Desktop.
Save likai24/457e49ce0ae69d997206cbe8c31d8e01 to your computer and use it in GitHub Desktop.
获取参数设置
#!/bin/bash
aflag=no
bflag=no
flist=""
set -- $(getopt abf "$@")
while [ $# -gt 0 ]
do
case "$1" in
-a) echo 1;;
-b) echo 2;;
-f) flist="$flist $2"; shift;;
--) shift; break;;
-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
*) break;;
esac
shift
done
echo $aflag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment