Compare commits

..

2 Commits

Author SHA1 Message Date
nirenjan 4497e4e3b1 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.
2020-09-09 07:50:13 -07:00
nirenjan a866ab7d4e Wrap gpg snippet to ensure that the command is available 2020-09-09 07:49:26 -07:00
2 changed files with 13 additions and 10 deletions

View File

@ -1,10 +1,13 @@
gpgconf --launch gpg-agent
export SSH_AUTH_SOCK="$HOME/.gnupg/S.gpg-agent.ssh"
TSOCK=$(gpgconf --list-dirs agent-ssh-socket || true)
if [[ -n "$TSOCK" ]]
if command -v gpgconf >/dev/null
then
gpgconf --launch gpg-agent
export SSH_AUTH_SOCK="$HOME/.gnupg/S.gpg-agent.ssh"
TSOCK=$(gpgconf --list-dirs agent-ssh-socket || true)
if [[ -n "$TSOCK" ]]
then
export SSH_AUTH_SOCK="$TSOCK"
unset TSOCK
fi
fi

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.