Reputation: 2983
I am getting quite tired of how Shells on Windows work - and, there aren't that many options. So I have considered just writing my own shell. However, whilst reading some documentation about the scripts generated by autotools, I noticed that sometimes, "SH compliant" or "POSIX-like compliant shell" is used.
As far as I know, Bash scripts are incompatible with Fish for instance, since &&
is replaced by a literal and
- and that is only one difference I could spot from a glance.
So what would a shell need to be "SH compliant" or "POSIX-like compliant shell"? Aside from reading commands to be executed and storing a few variables, there is not a whole lot a shell really does so I would assume it's only syntacticaly. Or, am I mistaken?
Upvotes: 8
Views: 6923
Reputation: 141493
So what would a shell need to be "SH compliant" or "POSIX-like compliant shell"?
It would need to follow the behavior as specified by the POSIX standards. POSIX is an open standard - you can read it online at https://pubs.opengroup.org/onlinepubs/9699919799/ . See section Shell & Utilities 2. Shell Command Language for documentation related to shell behavior.
There are no (at least I am not aware) certification companies that would certificate a specific shell program as "POSIX compliant". The whole operation systems are getting POSIX-certified and then these operating systems come with a POSIX-compatible shell. In the case of projects that do not have enough funds to get an external company for certification, it's usually in the will of the author to say if he aims for his creation to be POSIX compatible or not, and if he does, then the users expect the shell to behave as specified by POSIX.
Bash scripts are incompatible with Fish for instance
From bash manual:
It is intended to be a conformant implementation of the IEEE POSIX Shell and Tools portion of the IEEE POSIX specification (IEEE Standard 1003.1).
From fish home page:
Unlike other shells, fish does not follow the POSIX standard, but still uses roughly the same model.
Upvotes: 11