Introduction to Z Shell Scripting
Thus far, we’ve mainly talked about bash
, since it’s the preeminent login shell and scripting environment for Linux. In recent years, a fairly new kid on the block, Z Shell (zsh
) has been gaining a bit of popularity as a default login shell. But, even on the operating systems that come with zsh
as the login shell, bash
is still there, and bash
is what most people still use for scripting purposes. Be aware though, that scripting in zsh
does have certain advantages, such as better math capabilities, enhanced variable expansion, and the ability to use native zsh
commands instead of utilities such as find
, grep
, or sed
. These features can help you create scripts that are a bit simpler and lighter than equivalent bash
scripts.
Most articles and YouTube videos that you see about zsh
focus on the user interface enhancements, and very few focus on zsh
scripting. Unfortunately, the few books and tutorials that do focus on zsh
scripting aren...