From 8a907f86e6aee4fb127148a529d663dc9c77d4bb Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 5 Sep 2021 07:32:44 +0300 Subject: [PATCH 08/18] Replace uses of deprecated 'which' command with 'command -v' See osdn #42769 Signed-off-by: Marko Lindqvist --- bootstrap/generate_gitrev.sh | 2 +- data/flags/convert_png | 4 ++-- fc_version | 2 +- scripts/mapimg2anim | 6 +++--- scripts/setup_auth_server.sh | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bootstrap/generate_gitrev.sh b/bootstrap/generate_gitrev.sh index 132c9d3e3d..514af4ebe2 100755 --- a/bootstrap/generate_gitrev.sh +++ b/bootstrap/generate_gitrev.sh @@ -22,7 +22,7 @@ REV2="dist" # Check that all commands required by this script are available # If not, we will not claim to know which git revision this is # (REVSTATE will be OFF) - if which git && which tail && which wc ; then + if command -v git && command -v tail && command -v wc ; then REVTMP="$(git rev-parse --short HEAD 2>/dev/null)" if test "x$REVTMP" != "x" ; then # This is git repository. Check for local modifications diff --git a/data/flags/convert_png b/data/flags/convert_png index 8c4fa3831b..5a7a98ea4b 100755 --- a/data/flags/convert_png +++ b/data/flags/convert_png @@ -22,9 +22,9 @@ SHIELD_HEIGHT=14 SHIELD_WIDTH_LARGE=19 SHIELD_HEIGHT_LARGE=19 -which $RENDERER >/dev/null \ +command -v $RENDERER >/dev/null \ || (echo "You need $RENDERER to render the SVG files.") -(which convert >/dev/null && which composite >/dev/null) \ +(command -v convert >/dev/null && command -v composite >/dev/null) \ || (echo "You need ImageMagick to manipulate the images."; err=yes) for file0 in $files; do diff --git a/fc_version b/fc_version index 3f95171433..7db6481397 100755 --- a/fc_version +++ b/fc_version @@ -64,7 +64,7 @@ if test "x$FREECIV_LABEL_FORCE" != "x" ; then VERSION_LABEL=$(echo $FREECIV_LABEL_FORCE | sed "s//$VERSION_LABEL/g") fi -if test x$VERSION_REVTYPE = xgit && which git > /dev/null ; then +if test x$VERSION_REVTYPE = xgit && command -v git > /dev/null ; then VERSION_REV="$(git rev-parse --short HEAD)" else VERSION_REV="" diff --git a/scripts/mapimg2anim b/scripts/mapimg2anim index 8b7c6c00eb..9b86244a85 100755 --- a/scripts/mapimg2anim +++ b/scripts/mapimg2anim @@ -1,5 +1,5 @@ #!/bin/bash -#/********************************************************************** +#/*********************************************************************** # Freeciv - Copyright (C) 2010 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ basename=`basename ${scriptname}` # check for required tools (convert) have_convert=TRUE -prog_convert=`which convert` +prog_convert=`command -v convert` RES=$? if [ $RES -ne 0 ]; then # without this tool nothing can be done @@ -41,7 +41,7 @@ fi # check for required tools (ffmpeg) have_ffmpef=TRUE -prog_ffmpeg=`which ffmpeg` +prog_ffmpeg=`command -v ffmpeg` RES=$? if [ $RES -ne 0 ]; then have_ffmpef=FALSE diff --git a/scripts/setup_auth_server.sh b/scripts/setup_auth_server.sh index de9ef412ae..edf2986af1 100755 --- a/scripts/setup_auth_server.sh +++ b/scripts/setup_auth_server.sh @@ -18,7 +18,7 @@ # I know that this will not work with bare sh. Tested with bash, # so I set it in use above. -if which basename >/dev/null +if command -v basename >/dev/null then PROGRAM_NAME="$(basename $0)" else @@ -190,7 +190,7 @@ fi echo echo "First we populate the player database on the MySQL server" -if ! which mysql >/dev/null +if ! command -v mysql >/dev/null then echo "mysql command not found. Aborting!" exit 1 -- 2.33.0