Search code examples
zshzshrc

zsh prompt does not seem to work even when setting prompt_subst


I'm having some issues with my prompt (https://gist.github.com/zackp30/ccf91d6e476f1b6b8ec4), it only displays "anothertest", but it should toggle on every command, and, if this helps, $PS1 is set to "anothertest", and not the _zprompt_init function, any help will be greatly appreciated, I have also made sure prompt_subst is set. Thanks, Zack.


Solution

  • The error is in the comparison in line 10:

    if [[ a == 1 ]] ; then
    

    it has to be:

    if [[ $a == 1 ]] ; then
    

    In order to recall the value of parameters you have to prepend $ to their name.