From 8ca463b5c69e95ed100dd66e1134427319cf407c Mon Sep 17 00:00:00 2001 From: Changsheng Wu Date: Thu, 15 Dec 2022 03:34:11 -0500 Subject: [PATCH] Do not hardcode $SHELL path for bash (#260) Some systems do not have /bin/bash. e.g., Alpine and NixOS. This change reads the path dynamically via `which`. It solves the error `fork/exec /bin/bash`. --- bin/git-forgit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 85821bc..48e0a35 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -12,8 +12,11 @@ # This gives users the choice to set aliases inside of their git config instead # of their shell config if they prefer. -# Set shell for fzf preview commands -SHELL=/bin/bash +# Disable shellcheck for "which", because it suggests "command -v xxx" instead, +# which is not a working replacement. +# See https://github.com/koalaman/shellcheck/issues/1162 +# shellcheck disable=2230 +SHELL="$(which bash)" # Set shell for fzf preview commands # Get absolute forgit path FORGIT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/$(basename -- "${BASH_SOURCE[0]}")