diff --git a/misc/ext.d/doc.sh.in b/misc/ext.d/doc.sh.in index c296ca270..d8c465494 100644 --- a/misc/ext.d/doc.sh.in +++ b/misc/ext.d/doc.sh.in @@ -25,9 +25,9 @@ staroffice_console() { } get_ooffice_executable() { - if which loffice >/dev/null 2>&1; then + if command -v loffice >/dev/null 2>&1; then echo "loffice" - elif which ooffice >/dev/null 2>&1; then + elif command -v ooffice >/dev/null 2>&1; then echo "ooffice" else echo -n @@ -52,35 +52,35 @@ do_view_action() { fi ;; msdoc) - if which wvHtml >/dev/null 2>&1; then + if command -v wvHtml >/dev/null 2>&1; then tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html elinks -dump "$tmp/page.html" rm -rf "$tmp" - elif which antiword >/dev/null 2>&1; then + elif command -v antiword >/dev/null 2>&1; then antiword -t "${MC_EXT_FILENAME}" - elif which catdoc >/dev/null 2>&1; then + elif command -v catdoc >/dev/null 2>&1; then catdoc -w "${MC_EXT_FILENAME}" - elif which word2x >/dev/null 2>&1; then + elif command -v word2x >/dev/null 2>&1; then word2x -f text "${MC_EXT_FILENAME}" - else strings "${MC_EXT_FILENAME}" fi ;; msxls) - if which xlhtml >/dev/null 2>&1; then + if command -v xlhtml >/dev/null 2>&1; then tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` xlhtml -a "${MC_EXT_FILENAME}" > "$tmp/page.html" elinks -dump "$tmp/page.html" rm -rf "$tmp" - elif which xls2csv >/dev/null 2>&1; then + elif command -v xls2csv >/dev/null 2>&1; then xls2csv "${MC_EXT_FILENAME}" else strings "${MC_EXT_FILENAME}" fi ;; dvi) - which dvi2tty >/dev/null 2>&1 && \ + command -v dvi2tty >/dev/null 2>&1 && \ dvi2tty "${MC_EXT_FILENAME}" || \ catdvi "${MC_EXT_FILENAME}" ;; diff --git a/misc/ext.d/image.sh b/misc/ext.d/image.sh index d6ed138ed..46751c625 100755 --- a/misc/ext.d/image.sh +++ b/misc/ext.d/image.sh @@ -18,13 +18,13 @@ do_view_action() { [ -n "$DISPLAY" ] && sxpm "${MC_EXT_FILENAME}" ;; *) - if which exif >/dev/null 2>&1; then + if command -v exif >/dev/null 2>&1; then exif "${MC_EXT_FILENAME}" 2>/dev/null E=$? else E=1 fi - if [ $E != 0 ] && which exiftool >/dev/null 2>&1; then + if [ $E != 0 ] && command -v exiftool >/dev/null 2>&1; then exiftool "${MC_EXT_FILENAME}" 2>/dev/null fi identify "${MC_EXT_FILENAME}" @@ -47,20 +47,20 @@ do_open_action() { ;; *) if [ -n "$DISPLAY" ]; then - if which geeqie >/dev/null 2>&1; then + if command -v geeqie >/dev/null 2>&1; then (geeqie "${MC_EXT_FILENAME}" &) else (gqview "${MC_EXT_FILENAME}" &) fi # no backgrounding for console viewers - elif which fim >/dev/null 2>&1; then + elif command -v fim >/dev/null 2>&1; then fim "${MC_EXT_FILENAME}" - elif which fbi >/dev/null 2>&1; then + elif command -v fbi >/dev/null 2>&1; then fbi "${MC_EXT_FILENAME}" - elif which zgv >/dev/null 2>&1; then + elif command -v zgv >/dev/null 2>&1; then zgv "${MC_EXT_FILENAME}" # run-mailcap as a last resort - elif which see >/dev/null 2>&1; then + elif command -v see >/dev/null 2>&1; then (see "${MC_EXT_FILENAME}" &) fi ;; diff --git a/misc/ext.d/misc.sh.in b/misc/ext.d/misc.sh.in index 822cf2bf6..df590d6af 100644 --- a/misc/ext.d/misc.sh.in +++ b/misc/ext.d/misc.sh.in @@ -13,7 +13,7 @@ do_view_action() { case "${filetype}" in iso9660) - if which isoinfo > /dev/null 2>&1; then + if command -v isoinfo >/dev/null 2>&1; then isoinfo -d -i "${MC_EXT_FILENAME}" && isoinfo -l -R -J -i "${MC_EXT_FILENAME}" else 7za l "${MC_EXT_FILENAME}" @@ -74,7 +74,7 @@ do_open_action() { sqlite3 "${MC_EXT_FILENAME}" ;; glade) - if which glade-3 >/dev/null 2>&1; then + if command -v glade-3 >/dev/null 2>&1; then (glade-3 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) else (glade-2 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) diff --git a/misc/ext.d/text.sh.in b/misc/ext.d/text.sh.in index 357f9e11d..38d64c40e 100644 --- a/misc/ext.d/text.sh.in +++ b/misc/ext.d/text.sh.in @@ -129,7 +129,7 @@ do_open_action() { ;; chm) if [ -n "$DISPLAY" ]; then - which kchmviewer > /dev/null 2>&1 \ + command -v kchmviewer >/dev/null 2>&1 \ && (kchmviewer "${MC_EXT_FILENAME}" &) \ || (xchm "${MC_EXT_FILENAME}" &) else diff --git a/misc/ext.d/video.sh b/misc/ext.d/video.sh index 6ba131540..1584be9d7 100755 --- a/misc/ext.d/video.sh +++ b/misc/ext.d/video.sh @@ -15,10 +15,10 @@ do_view_action() { case "${filetype}" in *) - if which mplayer >/dev/null 2>&1; then + if command -v mplayer >/dev/null 2>&1; then mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | \ sed -n 's/^ID_//p' - elif which mpv_identify.sh >/dev/null 2>&1; then + elif command -v mpv_identify.sh >/dev/null 2>&1; then mpv_identify.sh "${MC_EXT_FILENAME}" else echo "Please install either mplayer or mpv to get information for this file" @@ -30,7 +30,7 @@ do_view_action() { do_open_action() { filetype=$1 - if which mpv >/dev/null 2>&1; then + if command -v mpv >/dev/null 2>&1; then PLAYER="mpv --really-quiet" else PLAYER="mplayer -really-quiet" diff --git a/src/vfs/extfs/helpers/iso9660.in b/src/vfs/extfs/helpers/iso9660.in index a4519dc3c..61b0b1357 100644 --- a/src/vfs/extfs/helpers/iso9660.in +++ b/src/vfs/extfs/helpers/iso9660.in @@ -32,7 +32,7 @@ #*** file scope functions ********************************************** -XORRISO=$(which xorriso 2>/dev/null) +XORRISO=$(command -v xorriso >/dev/null 2>&1) # This snippet is used to undo xorriso's Text_shellsafe(). Pseudocode for the # function: @@ -144,7 +144,7 @@ xorriso_rm() { # tested to comply with isoinfo 2.0's output test_iso () { - ISOINFO=$(which isoinfo 2>/dev/null) + ISOINFO=$(command -v isoinfo >/dev/null 2>&1) if test -z "$ISOINFO"; then echo "isoinfo not found" >&2 return 1 diff --git a/src/vfs/extfs/helpers/u7z b/src/vfs/extfs/helpers/u7z index d59d92f3e..6d3a4ccfa 100755 --- a/src/vfs/extfs/helpers/u7z +++ b/src/vfs/extfs/helpers/u7z @@ -17,10 +17,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -P7ZIP=`which 7z 2>/dev/null` \ - || P7ZIP=`which 7zz 2>/dev/null` \ - || P7ZIP=`which 7za 2>/dev/null` \ - || P7ZIP=`which 7zr 2>/dev/null` \ +P7ZIP=`command -v 7z >/dev/null 2>&1` \ + || P7ZIP=`command -v 7zz >/dev/null 2>&1` \ + || P7ZIP=`command -v 7za >/dev/null 2>&1` \ + || P7ZIP=`command -v 7zr >/dev/null 2>&1` \ || P7ZIP="" # Let the test framework hook in: diff --git a/src/vfs/extfs/helpers/urar.in b/src/vfs/extfs/helpers/urar.in index 71a4e82ad..d589ece17 100644 --- a/src/vfs/extfs/helpers/urar.in +++ b/src/vfs/extfs/helpers/urar.in @@ -16,7 +16,7 @@ RAR=rar # Prefer unrar (freeware). -UNRAR=`which unrar 2>/dev/null` +UNRAR=`command -v unrar >/dev/null 2>&1` [ -z $UNRAR ] && UNRAR=$RAR [ ! -x $UNRAR -a -x $RAR ] && UNRAR=$RAR diff --git a/src/vfs/extfs/helpers/uwim.in b/src/vfs/extfs/helpers/uwim.in index 76197f720..bb8fa34c2 100644 --- a/src/vfs/extfs/helpers/uwim.in +++ b/src/vfs/extfs/helpers/uwim.in @@ -10,8 +10,8 @@ # On Debian/Ubuntu wimtools can be installed via: # apt install wimtools -which wimlib-imagex 2>/dev/null > /dev/null || exit 1 -WIM=`which wimlib-imagex` +command -v wimlib-imagex >/dev/null 2>&1 || exit 1 +WIM=`command -v wimlib-imagex >/dev/null 2>&1` AWK=@AWK@ [ -n "$2" ] || exit 1