Created
April 28, 2023 09:57
-
-
Save unsafe9/2467bea8b6207c9a76ee47cf8b4698d7 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 | |
# Parse command line arguments | |
while [ $# -gt 0 ]; do | |
case $1 in | |
#--env=*) export ENV="${1#*=}"; shift;; | |
--env) export ENV="$2"; shift 2;; | |
*) args+=("$1"); shift;; | |
esac | |
done | |
# Validate parameters | |
if ! [[ "$ENV" =~ ^(dev|stg|prd)$ ]]; then | |
echo "Invalid environment: $ENV" | |
exit 1 | |
fi | |
echo "Extra args:" "${args[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment