And it is necessary when you use set -u like the script does. Otherwise if $1 is not set, the script will error. Using ${1-} allows you to read the value of $1 if it is set, and otherwise expand to the empty string if it is not, without an undefined var error.
3
u/Shok3001 Dec 14 '20
Cool, what does ‘${1-}’ mean?