3 ms·
The Z, Korn, Debian Almquist, Watanabe, and Bourne Again shells are all capable of running POSIX-conformant scripts. So if one has a POSIX-conformant shell scr
by JdeBP 3y ago
The Z, Korn, Debian Almquist, Watanabe, and Bourne Again shells are all capable of running POSIX-conformant scripts. So if one has a POSIX-conformant shell script, one can use the Z shell to run it, yes.
The major factors when it comes to portability are, for all of them, that (a) the POSIX-conformant mode has to be specially invoked, and (b) even if invoked in conformance mode the non-POSIX parts are not always turned off. It's not that the shells won't handle POSIX-conformant scripts. They even mostly will in their (default) non-conformant modes. It's rather that it's difficult to discipline onesself to keep within the bounds of POSIX conformance when writing, even if one tests with conformance mode switched on.
The Debian Almquist and Watanabe shells are the best at preventing non-POSIX stuff creeping in by accident, because the former doesn't have much of it in the first place and the latter actually does things like turn off non-POSIX option arguments and builtins so that they generate errors in conformance mode and one can detect accidental "Yashisms" in testing. With the others, it's easier to accidentally use some of their various extensions and not spot it without explicitly testing with something in addition to the shell in its POSIX-conformant mode.