Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
required arguments shell
set -e
set -o pipefail
while [[ "$#" > 0 ]]; do case $1 in
-f|--from) shift; FROM=$1;;
-t|--to) shift; TO=$1;;
-d|--dest) shift; DEST=$1;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done
required=( FROM TO DEST)
for i in "${required[@]}"
if [[ -z ${!i} ]]; then
echo "required arg $i was not passed"
exit 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.