In the middle of the desert you can say anything you want

27 Nov 2020

Day 697

Zsh prompt change based on dev/prod

The script that sets dev/prod sets a variable to 1 if using dev. Based on that variable I get (or not) a red (B) in my zsh prompt.

Did these changes to the theme clean2.zsh-theme:

PROMPT='%{$fg[green]%}(%*/%!)$ZSH_USING_DEV%{$fg[$NCOLOR]%}%B%b%{$reset_color%}%{$fg[blue]%}%B%5c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '

if [ "$USING_DEV" = "1" ] 

and in ~/.zsrhc

alias uc='. ~/s/ p'
alias ud='. ~/s/ d'

zsh prompt export variables from a script

Using the usual ./ way doesn’t work!

Note the . ~/s.. in the script above. Running it as ~/ will create a new shell, export the new values there, and close it. Starting with a . will make it run the script without starting a new shell. 1

  1. shell script - How to export an environment variable from .sh file in zsh? - Unix & Linux Stack Exchange ↩︎

Nel mezzo del deserto posso dire tutto quello che voglio.