Moving from Fish shell to zsh

2016/05/06

I’ve been using Fish shell as my daily driver for more than 2 years. I don’t want to insult Fish - this awesome shell provided me with wonderful out-of-the-box experience, introduced me to autosuggestions, and required almost no configuration.

But now, after 2 years of heavy usage, I’ve dropped it in favor of zsh.

The main reason for the switch is simple - Fish shell is not POSIX-compatible. And while many people keep repeating “If you don’t write shell scripts in Fish, why should you care about POSIX-compatibility?” like some sort of mantra, in fact you’ll face this non-compatibility very often, and in very frustrating way.

For example, you want to debug some piece of software. Instructions from the internet tells you to set up DEBUG variable like this: DEBUG=1 some-program --some-args.

If your shell is POSIX-compatible, you won’t notice any problems and will happily start debugging. But with Fish, you should always keep in mind all the changes Fish shell authors made to POSIX. For this example, you have to remember that you should use env DEBUG=1 some-program --some-args command, or some sort of ugly constructions like this: begin; set -lx DEBUG 1; some-program --some-args; end.

This is just a simple one-liner example, but in fact you’ll have much more frustrating encounters with some basic things like chaining commands (one && two should be written as one; and two), or redirecting stderr (use ^), or using command output (backtick doesn’t work).

You’ll have same problems with all the programs that use POSIX shell features to prepare environment, for example with boot2docker to set correct DOCKER_HOST, or ssh-agent to set SSH_AUTH_SOCKET.

All this problems are small, easy to fix, but eventually for me they’ve become a deal-breaker.

It’s just so much easier to spent some time configuring zsh and forget about all this compatibility rules, than facing same small problems with Fish shell every day.

After some experiments I’ve chosen excellent prezto configuration framework for zsh, enabled autosuggestions, syntax-highlighting and history-substring-search plugins, and now have all Fish goodies with zsh, but without dealing with POSIX-compatibility issues.

Tags: Fish Zsh

Categories: IT