0

I found zsh would print the command I type

⚡ root@default  /var/log/squid  pwd
pwd/var/log/squid
 ⚡ root@default  /var/log/squid  pwd
pwd/var/log/squid
 ⚡ root@default  /var/log/squid  rm /var/log/squid/*.log.0
rm#                                                                                                        
 ⚡ root@default  /var/log/squid  cd /
cd#                                                                                                            
 ⚡ root@default  /  cd -
cd/var/log/squid
 ⚡ root@default  /var/log/squid  ls
lslslsaccess.log  cache.log
 ⚡ root@default  /var/log/squid  vim ~/.zshrc
vimvimvim#                                                                                                     

I have oh-my-zsh installed . I check the ~/.zshrc , it is default setting , only with a different theme(I tried with default theme, same behavious) .

And I don't find this in bash.


Update

I found that every source ~/.zshrc, would add one more command print ... :

 ⚡ root@default  /var/log/squid  vim ~/.zshrc
vimvimvimvim#                                           
 ⚡ root@default  /var/log/squid  source ~/.zshrc
sourcesourcesourcesource#                               
 ⚡ root@default  /var/log/squid  ls
lslslslslsaccess.log  cache.log
 ⚡ root@default  /var/log/squid  vim ~/.zshrc
vimvimvimvimvim#                                        

~/.zshrc is default setting, I also update zsh to latest version.

How to solve this ?

1 Answer 1

0

Solve by add TERM=xterm-256color to ~/.zshrc (remote ubuntu) .

I think it is because I use msys2(mintty) to login remote ubuntu server. My msys2's TERM=screen-256color , I tried set same TERM on remote .

I don't understand why this only happen in zsh, would be glad if some one could explain this .

5
  • 1
    This was asked twice already here on or superuser or unix. I don't have time to look it up right now, sorry, but it was somehow related to TERM=screen being set outside of screen, and hence in turn zsh or oh-my-zsh emitting a screen-specific escape sequence to set the title to the command name. That escape sequence is unrecognized by your terminal emulator and hence the desired title (the command name) appears as regular text. Bottom of the story: always use TERM=screen-* inside screen/tmux, and never outside.
    – egmont
    Commented Nov 23, 2017 at 10:21
  • @egmont Thank you for explanation. But I have to use TERM=screen-256color in msys2 to make sure Home , End Ctrl + Arrow key work correctly in tmux with powerline theme . They don't work even in TERM=xterm-256color .
    – Mithril
    Commented Nov 23, 2017 at 11:14
  • Looks like I can use some setting like this unix.stackexchange.com/questions/139082/…
    – Mithril
    Commented Nov 23, 2017 at 11:24
  • TERM=screen-256color should be fine if and only if you are within a tmux or screen. Do you even experience the problem in that setup?
    – egmont
    Commented Nov 23, 2017 at 12:16
  • @egmont It is an env issue , msys2(on windows) and tmux (installed in msys2) , I need set TERM=screen-256color in both config file(~/.bashrc and ~/.tmux.conf ) to make tmux work as my demand(keyboard and theme). Now I find I can add some code to ~/.bashrc detect current session is in tmux or not , to set different TERM .
    – Mithril
    Commented Nov 23, 2017 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .