1

I've recently switched to zsh mainly for its auto-completion. However, zsh has syntax for scripting different from bash, and I use a lot of ad-hoc one-liners. For example, echo 'qwe\tasd' expands the \t to tab in zsh but not in bash. I want to keep all the bash syntax while using zsh's auto-completions.

I've tried adding emulate -LR bash to my .zshrc. However, it seems to break some of my zsh tools, namely zsh-autocomplete and starship.

How can I keep my bash syntax while using zsh?

ChocolateOverflow
  • 871
  • 1
  • 8
  • 21
  • How can I have my cake and eat it too? – jesse_b Jan 11 '21 at 14:29
  • 1
    `bash`'s `echo` expands `\t` as well at least in some builds or some environments. See the `xpg_echo` option in `bash` and the `bsdecho` option in `zsh`. See also [Why is printf better than echo?](//unix.stackexchange.com/q/65803) – Stéphane Chazelas Jan 11 '21 at 14:29
  • 1
    `emulate bash` or `emulate anything-that-starts-with-b` emulates `sh` or the Bourne shell. `emulate ksh` will give you a closer equivalent as `bash` is mostly a Korn-like shell. See also [emulate bash in zsh breaking dynamically assigned file descriptor](//unix.stackexchange.com/q/609795) – Stéphane Chazelas Jan 11 '21 at 14:30

1 Answers1

0

As pointed out in the comments and in emulate bash in zsh breaking dynamically assigned file descriptor, if you want Bash-like behavior in Zsh, you should actually put emulate ksh in your .zshrc file.

Marlon Richert
  • 3,715
  • 5
  • 30