As stated, bash is commonly available in the default installation for many distros. Your script will not reach the greatest user base by relying on zsh.
An important question to answer before designing your script is "Why does it matter which shell a script is executed in?"
Different shells use different syntax or offer additional shell functions that may not be supported by other shells. To write a script for the "general linux end user world," determine whether your script uses any syntax or shell functions that rely on a particular shell environment.
For example, bash shell supports certain expansions that are not supported by dash, Bourne shell, or whatever /bin/sh points to on the user's system.
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Feb 19 2014 /bin/sh -> dash
Try executing echo {1..10} with /bin/sh compared to /bin/bash and you'll get very different output.
The same goes for zsh which, while supporting most bash syntax, offers additional expansion and syntax that is not supported by the bash shell. See this tables comparing shells for specific examples.
You could broaden your potential user base beyond bashby adhering to scripts that work when called with #!/bin/sh -u. However, this gives rise to another important question to ask: "What is being sacrificed in exchange for greater portability?"
Determine whether differences relating to security concerns, functionality, efficiency, or anything else you feel is a priority for your script would be worth the sacrifice. You may not want wide spread use of a script with a known security vulnerability just because it works in more environments.
So many scripts are written for bash that support for these scripts is used as a criteria when comparing command shells. Many more people will be able to run your script than if it relies on zsh or any other syntax exclusive to a shell environment.
Also, keep in mind that you don't ultimately have control over how the user executes the script (also useful for debugging scripts in different shells):
Remember that if you use a shell to read a shell script (“sh
scriptname”), instead of executing it directly (“./scriptname”), the
shell will treat all the comments at the start of the shell script as
comments. In particular, the comment that specifies the interpreter to
use when executing the script (“#!/bin/sh -u”) will be ignored, as
will all of the options listed beside that interpreter.
So, the best you can do about this is make your scripts portable, so long as there is there is no great sacrifice to how it functions.
You might also see Bash coding conventions - Stack Overflow.