From 1fdf6b745cc3d85be3743837817a360121554134 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sun, 9 Aug 2020 15:33:37 -1000 Subject: treewide: replace `which` with `command -v` Fix shellcheck SC2230 > which is non-standard. Use builtin 'command -v' instead. Using `command -v` is POSIX compliant while `which` is not. Also to mention, `command -v` is a shell builtin whereas `which` is a separate busybox applet. Once applied to everything concerning OpenWrt we can disable the busybox feature `which` and save 3.8kB. Acked-by: Stijn Tintel Signed-off-by: Paul Spooren [also replace cases in zram-swap] Signed-off-by: Adrian Schmutzler --- scripts/ipkg-build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts/ipkg-build') diff --git a/scripts/ipkg-build b/scripts/ipkg-build index 21127f3391..6e027bc546 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -10,10 +10,10 @@ set -e version=1.0 -FIND="$(which find)" -FIND="${FIND:-$(which gfind)}" -TAR="${TAR:-$(which tar)}" -GZIP="$(which gzip)" +FIND="$(command -v find)" +FIND="${FIND:-$(command -v gfind)}" +TAR="${TAR:-$(command -v tar)}" +GZIP="$(command -v gzip)" # try to use fixed source epoch if [ -n "$SOURCE_DATE_EPOCH" ]; then @@ -21,10 +21,10 @@ if [ -n "$SOURCE_DATE_EPOCH" ]; then # look up date of last commit elif [ -d "$TOPDIR/.git" ]; then - GIT="$(which git)" + GIT="$(command -v git)" TIMESTAMP=$(cd $TOPDIR; $GIT log -1 -s --format=%ci) elif [ -d "$TOPDIR/.svn" ]; then - SVN="$(which svn)" + SVN="$(command -v svn)" TIMESTAMP=$($SVN info "$TOPDIR" | sed -n "s/^Last Changed Date: \(.*\)/\1/p") else TIMESTAMP=$(date) -- cgit v1.2.3