FIX 'which' check in 'sake' now works for aliases

Improves on the current implementations since
'command' already only returns executable commands.
Additionally, the success output of 'command' is not standardized
and may contain additional information.
Therefore, a 'test' if the result of 'command'
is a valid executable file, may fail incorrectly.

Now just relying on the standardized exit status of 'command -v'.
This commit is contained in:
Hernold Koch 2024-05-10 17:09:20 +02:00
parent 0c8fcfb54c
commit f8ba11e7f3
1 changed files with 1 additions and 4 deletions

5
sake
View File

@ -9,10 +9,7 @@ Executes a SilverStripe command"
exit 1
fi
if ! [ -x "$(command -v which)" ]; then
echo "Error: sake requires the 'which' command to operate." >&2
exit 1
fi
command -v which >/dev/null 2>&1 || { echo >&2 "Error: sake requires the 'which' command to operate."; exit 1; }
# find the silverstripe installation, looking first at sake
# bin location, but falling back to current directory