Skip to content

Instantly share code, notes, and snippets.

@hustlijian
Created March 23, 2019 08:49
Show Gist options
  • Save hustlijian/8c73443b873eaa08bc4e5d6eda5c0dbb to your computer and use it in GitHub Desktop.
Save hustlijian/8c73443b873eaa08bc4e5d6eda5c0dbb to your computer and use it in GitHub Desktop.
bash handle input aprameter
while [ "$1" != "" ]; do
case $1 in
-s ) shift
SERVER=$1 ;;
-d ) shift
DATE=$1 ;;
--paramter|p ) shift
PARAMETER=$1;;
-h|help ) usage # function call
exit ;;
* ) usage # All other parameters
exit 1
esac
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment