Use command -v to check for presence of a command

With a fresh install of zsh on OSX Catalina, the which command returns
text in stdout even if there is no corresponding command. Replacing it
with `command -v` ensures that the test does not give a false positive.
master
nirenjan 2020-09-09 07:50:13 -07:00
parent a866ab7d4e
commit 4497e4e3b1
1 changed files with 2 additions and 2 deletions

View File

@ -44,10 +44,10 @@ DCFILE="$HOME/.dircolors"
# a system which has the GNU coreutils installed
if [[ -f $DCFILE ]] && [[ -s $DCFILE ]]
then
if [[ ! -z `which dircolors` ]]
if command -v dircolors >/dev/null
then
eval `dircolors $DCFILE`
elif [[ ! -z `which gdircolors` ]]
elif command -v gdircolors >/dev/null
then
# OS X with coreutils installed from MacPorts will have
# dircolors installed by default as gdircolors.