Setup: OSX 10.11.5 El Capitan. Default (5.0.8) and/or brew installed zsh (5.2).

I have strange issues with zsh, where it seems to: a) mask single characters and b) adds strange control characters. This causes problems with pipes and parsing. It seems like zsh is adding extra or removing characters. It hasn't always done this, so I think it might be a configuration issue.

I'm assuming both issues are related and the first is easier to replicate.

If I set my shell to bash, then I can run the following:

Phils-MBP-7:~ phil-mac$ echo -n A
APhils-MBP-7:~ phil-mac$ 

Now, if I set my shell to zsh:

Phils-MBP-7:~ phil-mac$ chsh -s /bin/zsh
Phils-MBP-7% echo -n A
Phils-MBP-7% echo -n AA
AA%                                                                             Phils-MBP-7% 

Note how there is no single character version, and the AA version seems to have added a newline. Surely something to do with zsh trying and failing to make the output pretty.

Also, not sure if it's related, but in the terminal there is a small blue left square bracket that appears on the line above after pressing return.

Any ideas? Thanks in advance.


Result when running /bin/zsh directly:

Phils-MBP-7:~ phil-mac$ /bin/zsh
Phils-MBP-7% echo $PS1/$PROMPT
%m%# /%m%# 
Phils-MBP-7% echo -n A

Edit 2: Yes, it persists without the config:

Phils-MBP-7:~ phil-mac$ zsh -f
Phils-MBP-7% echo -n A

Running echo again:

Phils-MBP-7% echo -E $PS1

And nothing printed in the pre command hooks (I think that's what you meant @Adaephon):

Phils-MBP-7% whence precmd preexec $precmd_functions $preexec_functions
  • 1
    Could you post the $PS1/$PROMPT values in zsh? Sounds a bit like incomplete \e sequence somewhere. (also, you know you could run /bin/zsh directly, without using chsh...) – grawity Aug 2 '16 at 8:36
  • Added info to post. Code formatting issue. – Phil Winder Aug 2 '16 at 8:39
  • Just echoing $PS1 might not show defective escape sequences, as the zsh-builtin echo by default evaluates escape codes. Please run echo -E $PS1 instead. It might also be worth checking, if something is printed in a precmd or preexec hook: whence precmd preexec $precmd_functions $preexec_functions. Also, does the problem persist, when you run zsh without configuration: zsh -f? – Adaephon Aug 2 '16 at 11:26

Your Answer

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

Browse other questions tagged or ask your own question.