Skip to content

Instantly share code, notes, and snippets.

@pebo
Last active March 22, 2016 07:40
Show Gist options
  • Save pebo/edfc0c47bccb58dd3b9c to your computer and use it in GitHub Desktop.
Save pebo/edfc0c47bccb58dd3b9c to your computer and use it in GitHub Desktop.
Show AWS_PROFILE in prompt
# with colors
awsp () {
export AWS_PROFILE=$1
if [[ $AWS_PROFILE =~ dev ]]
then
COLOR_PROFILE='\[\033[38;5;70m\]${AWS_PROFILE}\[$(tput sgr0)\]'
elif [[ $AWS_PROFILE =~ prod ]]
then
COLOR_PROFILE='\[$(tput setaf 1)\]${AWS_PROFILE}\[$(tput sgr0)\]'
else
COLOR_PROFILE='\[$(tput setaf 4)\]${AWS_PROFILE}\[$(tput sgr0)\]'
fi
export PS1="[$COLOR_PROFILE]:\W \u$ "
}
awsp () {
export AWS_PROFILE=$1
export PS1="[$AWS_PROFILE]:\W \u$"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment