By “switch to zsh”, I assume that you mean one of two things:
- you will use
chsh
(or equivalent) to change your login shell to zsh, or
- you will configure Terminal (or equivalent) to use zsh as its default shell.
Most shell programs (shell “scripts”) will include a “shebang”/“hash-bang” line. The shebang declares which interpreter (shell) should interpret (run) the program that follows it.
As several other answers indicate, shell programs that use a shebang line will not be affected by the user's selection of login shell, nor by the interactive shell that is the parent or Nth-parent of a launched shell program.
If you are installing a new version of zsh and including it in your PATH, programs that use a shebang like #!/usr/bin/env zsh
will use that new version (when the are started with a PATH that puts the new zsh first). This can only cause problems if some incompatible change was made between your old/original version of zsh and the new one. Note that this would be an intra-zsh (inter-zsh-version) problem, not the inter-shell problem about which I suspect you are concerned. This is usually a much smaller category of error than if (e.g.) you tried running a ran a bash program with ksh.
Not using a shebang line is inherently not portable between user environments. The result of trying to run an executable, non-binary† file that lacks a shebang depends on the environment (OS, shell, possibly login shell, and environment variables). When such a file is run on my Mac OS X 10.4 system, the behavior varies according to the shell that runs it. ksh, and bash both interpret the file in a forked copy of themselves. zsh always passes it off to /bin/sh
. If some program were to try to exec
it directly, it would fail with ENOEXEC
(this happens inside the shell, they just “cover for it” by “running” it in an alternate way). I have a vague memory of some ancient systems even trying to use the user's login shell in this situation, but my quick searching did not turn up anything useful.
† A non-binary file is a file that the kernel does not recognize as one of its supported binary object formats.
As far as interactive compatibility goes, zsh supports much of the extended syntax from bash and ksh (some of if must be enabled with shell options, though), so much of the “shell” advice you find on Super User will work just fine in zsh (even if some of it is comprised of “bashisms”). Some things (command line editing bindings, completion‡, prompt displays, etc.) are wholly different from bash and ksh and will require different syntax for similar operations.
‡ zsh does have a bit of bash completion compatibility, but I have never tried it.
zsh
as the default, instead ofbash
. Hoping this question and its answers are still mostly relevant 9 1/2 years later, lol!