From 29e30e8af4b937cd0d4c9b5eb900205f22bddf7b Mon Sep 17 00:00:00 2001 From: Jeff Kowalski Date: Sun, 11 Sep 2022 21:17:07 -0700 Subject: [PATCH] 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'?). --- bin/doomscript | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/doomscript b/bin/doomscript index 1c16caf37..53912ab8b 100755 --- a/bin/doomscript +++ b/bin/doomscript @@ -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