From 78eef004afe7c7c924435808663802cca11c7784 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 5 Sep 2021 00:34:26 +0200 Subject: [PATCH] Replace deprecated 'which' in scripts --- Makefile | 6 +++--- pm3 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index afa30c0f8..9aeea7353 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ print-%: ; @echo $* = $($*) style: # Make sure astyle is installed - @which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 ) + @command -v astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 ) # Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile, *.v, pm3 find . \( -not -path "./cov-int/*" -and -not -path "./fpga*/xst/*" -and \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" -or -name "*.v" -or -name "pm3" \) \) \ -exec perl -pi -e 's/[ \t]+$$//' {} \; \ @@ -267,7 +267,7 @@ style: # Update commands.md [ -x client/proxmark3 ] && client/proxmark3 -m > doc/commands.md # Make sure python3 is installed - @which python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 ) + @command -v python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 ) # Update commands.json [ -x client/proxmark3 ] && client/proxmark3 --fulltext | python3 client/pyscripts/pm3_help2json.py - doc/commands.json @@ -282,7 +282,7 @@ miscchecks: TABSCMD+= && vi {} -c ':set tabstop=4' -c ':set et|retab' -c ':wq' endif miscchecks: # Make sure recode is installed - @which recode >/dev/null || ( echo "Please install 'recode' package first" ; exit 1 ) + @command -v recode >/dev/null || ( echo "Please install 'recode' package first" ; exit 1 ) @echo "Files with suspicious chars:" @find . \( -not -path "./cov-int/*" -and -not -path "./client/deps/*" -and \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" -or -name "*.v" -or -name "pm3" \) \) \ -exec sh -c "cat {} |recode utf8.. >/dev/null || echo {}" \; diff --git a/pm3 b/pm3 index 0aea8942c..68719937b 100755 --- a/pm3 +++ b/pm3 @@ -58,7 +58,7 @@ function get_pm3_list_Linux { exit 1 fi for DEV in $(find /dev/ttyACM* 2>/dev/null); do - if which udevadm >/dev/null; then + if command -v udevadm >/dev/null; then if udevadm info -q property -n "$DEV" | grep -q "ID_VENDOR=proxmark.org"; then PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then @@ -77,7 +77,7 @@ function get_pm3_list_Linux { if $FINDBTDONGLE; then # check if the HC-06-USB white dongle is present (still, that doesn't tell us if it's paired with a Proxmark3...) for DEV in $(find /dev/ttyUSB* 2>/dev/null); do - if which udevadm >/dev/null; then + if command -v udevadm >/dev/null; then if udevadm info -q property -n "$DEV" | grep -q "ID_MODEL=CP2104_USB_to_UART_Bridge_Controller"; then PM3LIST+=("$DEV") if [ ${#PM3LIST[*]} -ge "$N" ]; then @@ -440,7 +440,7 @@ HOSTOS=$(uname | awk '{print toupper($0)}') if [ "$HOSTOS" = "LINUX" ]; then if uname -a|grep -q Microsoft; then # First try finding it using the PATH environment variable - PSHEXE=$(which powershell.exe 2>/dev/null) + PSHEXE=$(command -v powershell.exe 2>/dev/null) # If it fails (such as if WSLENV is not set), try using the default installation path if [ -z "$PSHEXE" ]; then