Created
May 8, 2025 19:11
-
-
Save deeheber/e2102e240c84842a275296688756f0e8 to your computer and use it in GitHub Desktop.
Add current AWS_PROFILE to PS1 prompt
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_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