If a gsu script
(a) enables the -u option to treat unset variables as
an error for parameter expansion,
(b) does not set TMPDIR,
(c) calls gsu_make_tempfile(),
gsu_make_tempfile() fails with an "TMPDIR: unbound variable" error.
The code already contains a fallback for this case, so we can use
the :- construct to avoid the error and fall back to /tmp if TMPDIR
is unset or NULL.
if [[ "${template:0:1}" != '/' ]]; then # relative path
if (($# > 1)); then
dir="$2"
- elif [[ -n "$TMPDIR" ]]; then
+ elif [[ -n "${TMPDIR:-}" ]]; then
dir="$TMPDIR"
else
dir="/tmp"