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.
1 : the cause, reason, or purpose for which know why you did it that is why you did it. 2 : for which : on account of which know the reason why you did it. why. noun.
To identify songs, open Control Center, then tap the Shazam button . Shazam can identify songs playing on your device even when you're using headphones. To find songs you've identified, touch and hold the Shazam button in Control Center to open your History View.
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.
Actually, fish
is not compliant with the POSIX sh
definition. But neither is csh
(and probably zsh
). You still can use fish
as your interactive shell.
For example echo $$
shows the pid of the shell in POSIX sh
. But with fish
it does not.
(and that is why I did not switch to fish
and keep using zsh
as my daily interactive login shell)
You could change your interactive login shell (using chsh
) to fish
.
But if you write shell scripts, writing them for the POSIX sh
specification make these scripts more portable. (You'll use the shebang #!/bin/sh
to start them, it is understood by Linux execve(2)). In some cases, you don't care about portability of your shell script and you could make them start with #!/usr/bin/fish
to be fish
scripts. Then they won't work on systems without fish
.
Also, the system(3) C standard library function uses /bin/sh -c
.
I enjoyed very much Yann Regis-Gianas' talk on POSIX [s]hell at FOSDEM2018.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With