Setup
We’re going to use zsh as it is always available on any system I use:
#! /bin/zsh -f
Note
The -f
option protects us from adverse interactions in the user’s
zsh configuration files. They shouldn’t cause problems, but
this build is part of an installation process that occurs before
zsh configuration is necessarily complete.
We’ll want stricter defaults out of the box:
Option |
Description |
---|---|
|
Exit immediately if a command exits with a non-zero status. |
|
Treat unset variables as an error. |
|
Warn when a global variable is created. |
setopt err_exit no_unset warn_create_global
We’ll need zutil to allow us to process command line arguments:
zmodload -F zsh/zutil +b:zparseopts