Skip to content

Instantly share code, notes, and snippets.

@deeheber
Created May 8, 2025 19:11
Show Gist options
  • Save deeheber/e2102e240c84842a275296688756f0e8 to your computer and use it in GitHub Desktop.
Save deeheber/e2102e240c84842a275296688756f0e8 to your computer and use it in GitHub Desktop.
Add current AWS_PROFILE to PS1 prompt
aws_profile() {
if [[ -n "$AWS_PROFILE" ]]; then
echo "%F{yellow}[AWS:$AWS_PROFILE]%f "
elif [[ -n "$AWS_DEFAULT_PROFILE" ]]; then
echo "%F{yellow}[AWS:$AWS_DEFAULT_PROFILE]%f "
else
echo ""
fi
}
# Add AWS profile to your PS1 prompt with color support
setopt PROMPT_SUBST
PS1='$(aws_profile)'$PS1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment