News for hackers. Stuff that matters.
Re:Zsh 5.9 by adrian_b on Monday May 16, 2022 @02:02PM (#31401167)
I have been using bash for decades, not only on Linux, but also on other UNIX-derived operating systems.

Less than a year ago, I have tried zsh, without a definite intention to switch to it, but eventually I ended always using zsh for interactive use, while continuing to use bash for scripts.

I have benchmarked some scripts with both zsh and bash, but I have not seen any significant difference in speed.

While there are a few scripting features originally introduced by zsh (most of the brace expansion variants), bash has also incorporated them many years ago. Besides those, both bash and zsh implement the ksh93 features, so there is little reason to prefer one or the other. Therefore I have stuck to bash for scripts.

It is hard to say exactly why now I prefer zsh for interactive use, because there is no killer feature, but mostly various small details.

For some reason, zsh seems more responsive, when interactive. I rely a lot on autocompletion and the default autocompletion rules in zsh are more powerful and also the zsh autocompletion seems faster.

While in most cases I prefer the way zsh handles autocompletion, there are times when zsh annoys me by trying to be too smart, e.g. it will never autocomplete "mkdir" with the name of an existing file. I need that frequently, when I want to create a subdirectory in which to move a bunch of related files, with very long names that I do not want to type, but I want to edit slightly to make a name for the new subdirectory, so I have to use a workaround like autocompleting a "ls", then editing it into a "mkdir", while that was not needed in bash.

In zsh I use a much more complex shell prompt that I had used in bash, which displays a lot of useful information in a format that avoids confusion with the command lines or with the text output of the executed commands.

After switching to it in zsh, I have discovered that such a complex shell prompt is also possible in bash. Nevertheless, after using it in bash I have discovered some bash bugs. The too complex shell prompt confused bash and the text cursor became desynchronized with the correct position in certain contexts, so I had to revert in bash to a simple shell prompt.

I think that you should give zsh a try for interactive use. After using it for some days you will see if you prefer it to bash or not.

Now I prefer the interactive zsh, but there are no large differences, bash and zsh are similar and mostly equivalent, because whenever one was improved somehow, the other also copied that feature soon.

I had completely forgotten, but when I have tried for the first time to use zsh as a bash user, I have spent some ten minutes of great confusion, until discovering that I have to add to my ".zshrc" the lines:

bindkey '^[[H' beginning-of-line

bindkey '^[[F' end-of-line

bindkey '^[[3~' delete-char-or-list

in order to have the line editing keys with which I was accustomed.

There are no comments on this comment yet.