Created
June 26, 2016 06:04
-
-
Save likai24/457e49ce0ae69d997206cbe8c31d8e01 to your computer and use it in GitHub Desktop.
获取参数设置
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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