mirror of https://github.com/nirenjan/dotfiles.git
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
parent
a866ab7d4e
commit
4497e4e3b1
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue