From 1d150ab1075f7ee822d02f15a1a1ce425ee547a8 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 29 Mar 2013 13:19:58 -0400 Subject: [PATCH] dotfiles.sh: Replace `which` with `command -v` I learned (via the Git list [1]) that `which` is not part of POSIX. The POSIX 2008 equivalent is `command -v` [2]. We can make the shell introduction more portable by sticking to the POSIX utilities [3], especially since `command` is a Bash builtin. [1]: http://article.gmane.org/gmane.comp.version-control.git/216007 [2]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html [3]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap04.html#tag_20 --- dotfiles.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index 5734dfb..43309ba 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -26,17 +26,17 @@ CHECK_WGET_TYPE_AND_ENCODING='no' ##### # External utilities -DIFF=${DOTFILES_DIFF:-$(which diff)} -GIT=${DOTFILES_GIT:-$(which git)} -LN=${DOTFILES_LN:-$(which ln)} -MV=${DOTFILES_MV:-$(which mv)} -PATCH=${DOTFILES_PATCH:-$(which patch)} -SED=${DOTFILES_SED:-$(which sed)} -RM=${DOTFILES_RM:-$(which rm)} -RSYNC=${DOTFILES_RSYNC:-$(which rsync)} -TAR=${DOTFILES_TAR:-$(which tar)} -TOUCH=${DOTFILES_TOUCH:-$(which touch)} -WGET=${DOTFILES_WGET:-$(which wget)} +DIFF=${DOTFILES_DIFF:-$(command -v diff)} +GIT=${DOTFILES_GIT:-$(command -v git)} +LN=${DOTFILES_LN:-$(command -v ln)} +MV=${DOTFILES_MV:-$(command -v mv)} +PATCH=${DOTFILES_PATCH:-$(command -v patch)} +SED=${DOTFILES_SED:-$(command -v sed)} +RM=${DOTFILES_RM:-$(command -v rm)} +RSYNC=${DOTFILES_RSYNC:-$(command -v rsync)} +TAR=${DOTFILES_TAR:-$(command -v tar)} +TOUCH=${DOTFILES_TOUCH:-$(command -v touch)} +WGET=${DOTFILES_WGET:-$(command -v wget)} ##### # Compatibility checks -- 2.26.2