Why you shouldn’t use the fish shell

The POSIX standard is a set of rules a UNIX-based operating system should follow. However, this isn’t always the case. While it’s perfectly fine to extend the POSIX standard to add more features and improve functionality –as seen in bash and zsh– there’s a third very popular shell that that has gained significant attention: Fish

the Friendly Interactive SHell

fish is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family.1

Fish is often marketed as a user-friendly shell, and it does offer some appealing features for interactive use. However, its design choices and lack of POSIX compliance make it a poor choice for scripting and not a very good one for interactive use.

Fish vs POSIX

Fish’s lack of POSIX compliance is presented as one of its best features, however, personally is the most significant drawback. This means scripts written for Fish may not run correctly on other shells, and vice versa. This can be a major issue if you need to write portable scripts that should run on a variety of systems.

Other shells vs POSIX

bash and zsh are not strictly POSIX-compliant shells because they extend the POSIX standard with additional functionality that isn’t part of the specification. While they are largely compatible with POSIX, their extra features can lead to scripts that don’t work in strictly POSIX-compliant environments. This is why I always recommend writing scripts in POSIX-compliant shell syntax whenever possible. Scripts written in POSIX-compliant shell can run on virtually any UNIX-like system, from macOS to OpenBSD to Linux (every sane OS—Windows not included!).

Some people (especially soydev sysadmins) like to write #!/bin/bash scripts, this, clearly, is an skill issue, just write #!/bin/sh and get good. This is the exact same problem.

Bash Zsh POSIX Fish
Can run bash and POSIX scripts. Can run bash, zsh and POSIX scripts Can only run POSIX-compliant scripts. ensuring maximum portability Can only run Fish scripts, it doesn’t even run POSIX scripts

Why POSIX Compliance Matters

POSIX compliance ensures that your scripts will work across different UNIX-like systems without modification. While shells like bash and zsh offer additional features that can make interactive use more enjoyable, relying on these extensions for scripting will lead to compatibility issues. Fish, takes this problem to the extreme by just abandoning POSIX compliance altogether, making it a poor choice for scripting and a questionable one for interactive environments (Just use zsh!!).

Conclusion

If I had to summarize this post in a single phrase, it would be ‘skill issue’.

ZEKAR


I know POSIX syntax can be VERY different to other programming languages, but I find it very pretty tbh.

2025-03-20