base-files/functions.sh: use command -v instead of which
authorRosen Penev <rosenp@gmail.com>
Fri, 17 Jan 2020 22:38:19 +0000 (14:38 -0800)
committerPetr Štetiar <ynezz@true.cz>
Sat, 11 Jul 2020 12:42:32 +0000 (14:42 +0200)
which must be executed. command -v is a shell builtin.

https://github.com/koalaman/shellcheck/wiki/SC2230

Signed-off-by: Rosen Penev <rosenp@gmail.com>
package/base-files/files/lib/functions.sh

index a77b669709ff7b2895e2cb20a5d86c6203700428..323e057451ca57c401d77a025345142c0126da1d 100755 (executable)
@@ -176,7 +176,7 @@ default_prerm() {
                ret=$?
        fi
 
-       local shell="$(which bash)"
+       local shell="$(command -v bash)"
        for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
                if [ -n "$root" ]; then
                        ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
@@ -264,7 +264,7 @@ default_postinst() {
                rm -f /tmp/luci-indexcache
        fi
 
-       local shell="$(which bash)"
+       local shell="$(command -v bash)"
        for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
                if [ -n "$root" ]; then
                        ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable