When I run a #!/bin/sh script containing set -o xtrace in an interactive zsh I get weird output looking like %F{red}>> %f. Obviously the PS4 of my .zshrc is used but the interpreting shell is sh. How can I avoid this?

1 Answer 1


Do not export the PS4 variable whenever you're setting it in your ~/.zshrc. Just set it as if it were an internal variable (which is what it is).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.