Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Shell Compatibility



On Sun, Aug 24, 2025, at 12:48 AM, McPherran Web - Support wrote:
> Hi, friendly question/plug: Can zsh run most scripts that "bash" runs?

In sh/ksh emulation mode, it can run many scripts that bash can,
but I would consider "most scripts" to be an overstatement.

In default mode, it can only run the most drop-dead simple scripts
due to some fundamental differences in behavior.


> Is this capability as well as POSIX compatibility considered an 
> important aspect of zsh?

Not really.  It's a low priority.


> (POSIX seems a bit limited, so perhaps 
> inter-shell compatibility is more important in actual practice and 
> usage.)

In general, zsh does not specifically aim for bash compatibility.

The sh/ksh emulation mode does accommodate some ksh features that
bash has adopted, but broadly speaking the further a script strays
from POSIX, the less likely it is that emulation can handle it
acceptably.

See the documentation for more details:

https://zsh.sourceforge.io/Doc/Release/Invocation.html#Compatibility
https://zsh.sourceforge.io/FAQ/zshfaq02.html#l10
https://zsh.sourceforge.io/FAQ/zshfaq02.html#l17


> As I say, it's a "plug" as well as a question so the "plug" is 
> that in general I'd like to be able to use zsh in place of "bash" as 
> much as possible. :-)

As far as running scripts is concerned, I don't think this goal is
feasible or worthwhile.  There are just too many scripts out there
that require bash features/bugs (whether by design or by accident).
Even for POSIX scripts, sh emulation is good but not comprehensive.


-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author