Skip to content

Instantly share code, notes, and snippets.

@AmreeshTyagi
Last active March 22, 2018 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmreeshTyagi/e3b79b16a863137a52355578c90de68a to your computer and use it in GitHub Desktop.
Save AmreeshTyagi/e3b79b16a863137a52355578c90de68a to your computer and use it in GitHub Desktop.
#!/bin/bash
verbose='false'
aflag=''
bflag=''
files=''
while getopts 'abf:v' flag; do
case "${flag}" in
a) aflag='true' ;;
b) bflag='true' ;;
f) files="${OPTARG}" ;;
v) verbose='true' ;;
*) error "Unexpected option ${flag}" ;;
esac
done
#Ref: https://stackoverflow.com/questions/7069682/how-to-get-arguments-with-flags-in-bash-script/7069755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment