How does your shell know which environment you're in? Is it that you ssh into one environment or another one, and you want the badge to show which one you've connected to?
I cut and paste environment variables into the shell to authenticate to different accounts. Originally, I was trying to trigger an event by looking for specific words (ie. AWS_SECRET_ID) but that didn't seem to work reliably.
Consider giving yourself some bash functions with appropriate names, which set the env vars and switch the badge too. Then instead of pasting each time, you'll just use the function name in the shell.