Created
January 11, 2019 19:34
-
-
Save dustydecapod/33aaf5de2d14fe4ccc8c975588a4872b to your computer and use it in GitHub Desktop.
aws-env manager
This file contains hidden or 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
aws-env () { | |
if [[ -n "$1" ]]; then | |
if [[ ! -f ~/.aws/credentials ]]; then | |
print -P "%F{red}No AWS Credentials Found%f" | |
return | |
fi | |
if [[ $(grep -F \[$1\] ~/.aws/credentials) = "" ]]; then | |
print -P "%F{red}Environment '$1' not found in AWS credentials file%f" | |
return | |
fi | |
export AWS_PROFILE="$1" | |
else | |
unset AWS_PROFILE | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment