fix(cli): follow-on syntax fixes to #6772

While fixing #6772, we also address several other issues found by
sh-shellcheck:

L47C39 SC1007:Remove space after = if trying to assign a value
(for empty string, use var='' ... ).

L47C46 SC2046:Quote this to prevent word splitting.

L62C20 SC2086:Double quote to prevent globbing and word splitting.

L82C9  SC2154:tmpdir is referenced but not assigned
(did you mean 'TMPDIR'?).
This commit is contained in:
Jeff Kowalski 2022-09-11 21:17:07 -07:00 committed by Henrik Lissner
parent 571ab7425a
commit 29e30e8af4

View file

@ -44,7 +44,7 @@ fi
# Doom respects $EMACSDIR to tell it where Doom lives. If it fails, then this is
# either isn't bash, or it's a posix shell being directly sourced with sh, which
# is unsupported.
export EMACSDIR="${EMACSDIR:-$(CDPATH= cd -- $(dirname -- "${BASH_SOURCE:-$0}")/.. && pwd)}"
export EMACSDIR="${EMACSDIR:-$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE:-$0}")/.." && pwd)}"
if [ ! -f "$EMACSDIR/early-init.el" ]; then
>&2 echo "Error: cannot load $EMACSDIR/early-init.el."
>&2 echo
@ -59,7 +59,7 @@ fi
export __DOOMPID="${__DOOMPID:-$$}"
export __DOOMSTEP="$((__DOOMSTEP+1))"
export __DOOMGEOM="${__DOOMGEOM:-$(tput cols lines 2>/dev/null)}"
export __DOOMGPIPE=${__DOOMGPIPE:-$__DOOMPIPE}
export __DOOMGPIPE="${__DOOMGPIPE:-$__DOOMPIPE}"
export __DOOMPIPE=
[ -t 0 ] || __DOOMPIPE="${__DOOMPIPE}0"
[ -t 1 ] || __DOOMPIPE="${__DOOMPIPE}1"
@ -79,7 +79,7 @@ exit=$?
if [ "${exit:-0}" -eq 254 ]; then
# The user may have a noexec flag set on /tmp, so the exit-script should be
# passed to /bin/sh rather than executed directly.
sh "${tmpdir}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@"
sh "${TMPDIR}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@"
exit="$?"
fi
exit $exit