Why & How fish does not support POSIX?

Cy8099 picture Cy8099 · Feb 11, 2018 · Viewed 12.9k times · Source

I have heard about fish that it's a friendly and out-of-box shell but also it doesn't support POSIX standard. On the other hand I read about POSIX standard (and also I tested it on my Fedora, It's amazing and out-of-box shell now I want to change my default shell to fish).

But the matter that I opened this question for is: I misunderstood about relation between fish and POSIX standard, what do you mean about fish does NOT support POSIX exactly? & How? (Should I change my bash to fish?).

Please explain it simple 'cause I'm a little newbie, thanks.

Answer

that other guy picture that other guy · Feb 11, 2018

fish isn't and never tried to be compatible with POSIX sh.

This really just means that it's a separate language (like Java, Python or Ruby) rather than an implementation or extension of sh (like Bash, Dash and Ksh).

Obviously, just like you can't copy-paste Java snippets into a Python program, you can't copy-paste sh code into fish.

In practice, this means that when you search for things like "how do I show the current git branch in my prompt", you need to make sure you find fish answers because the sh ones won't work. Similarly, when books or instructions give commands to run, you may occasionally need to rewrite some of them manually (or open a bash shell and paste them there).

Whether this matters is entirely up to you, so definitely give it a go.