3 ms·
That's why it's a good rule of thumb to just stick with POSIX as defined by the POSIX standard [0] 0: https://pubs.opengroup.org/onlinepubs/9699919799/utilitie
by justaj 4y ago
That's why it's a good rule of thumb to just stick with POSIX as defined by the POSIX standard [0]
0: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...
- GuB-42 4y agoTotally agree, tough I am not sure that all shells that pretend to be POSIX really are. But it is a minefield, it is way to easy to sneak-in a bashism because you are so sure it is POSIX that you didn't check, made worse by the fact that if you are writing shell scripts, you are probably using an much more liberal interactive shell all day long. And your script will work and no one will complain until you try to run it on another system. It is not entirely unlike client-side web technologies, where you have to check for browser compatibility. For the web, it is a recognized problem and there are plenty of solutions to deal with it: jquery, babel, etc... I am not aware of such tools for shell scripts, or maybe just analyzers that check for posix compliance.
- justaj 4y agoThat's easily solved with http://www.shellcheck.net/ http://www.shellcheck.net/