diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index 31a2fb077..705d36a9c 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -149,7 +149,7 @@ if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then # All servers except ts3 require tmux if [ "${gamename}" != "TeamSpeak 3" ]; then - if [ "$(command -v tmux 2>/dev/null)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then + if [ "$(command -v tmux 2>/dev/null)" ]; then tmuxcheck=1 # Added for users compiling tmux from source to bypass check. else array_deps_required+=( tmux ) @@ -246,7 +246,7 @@ elif [ -n "$(command -v yum 2>/dev/null)" ]; then # All servers except ts3 require tmux if [ "${gamename}" != "TeamSpeak 3" ]; then - if [ "$(command -v tmux 2>/dev/null)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then + if [ "$(command -v tmux 2>/dev/null)" ]; then tmuxcheck=1 # Added for users compiling tmux from source to bypass check. else array_deps_required+=( tmux ) diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index 13040a00f..97fdf6566 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -118,7 +118,7 @@ fn_stop_graceful_sdtd(){ sleep 1 if [ "${telnetenabled}" == "false" ]; then fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}" - elif [ "$(command -v expect 2>/dev/null)" ]||[ "$(which expect >/dev/null 2>&1)" ]; then + elif [ "$(command -v expect 2>/dev/null)" ]; then # Tries to shutdown with both localhost and server IP. for telnetip in 127.0.0.1 ${ip}; do fn_print_dots "Graceful: telnet: ${telnetip}" diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index d279ab85b..f45b8938d 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -238,13 +238,7 @@ fn_update_function(){ } # Defines curl path -curl_paths_array=($(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl) -for curlpath in "${curl_paths_array}" -do - if [ -x "${curlpath}" ]; then - break - fi -done +curlpath=$(command -v curl 2>/dev/null) if [ "$(basename ${curlpath})" != "curl" ]; then echo "[ FAIL ] Curl is not installed" diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 2e33c9203..e2f2691ef 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -206,7 +206,7 @@ fn_update_ts3_compare(){ fn_update_ts3_arch if [ "${installer}" == "1" ]; then # if jq available uses json update checker - if [ "$(command -v jq)" ]||[ "$(which jq >/dev/null 2>&1)" ]; then + if [ "$(command -v jq >/dev/null 2>&1)" ]; then fn_update_ts3_availablebuild else fn_update_ts3_availablebuild_legacy diff --git a/linuxgsm.sh b/linuxgsm.sh index 1b87bb284..95cb95562 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -70,13 +70,8 @@ fn_bootstrap_fetch_file(){ mkdir -p "${local_filedir}" fi # Defines curl path - curl_paths_array=($(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl) - for curlpath in "${curl_paths_array}" - do - if [ -x "${curlpath}" ]; then - break - fi - done + curlpath=$(command -v curl 2>/dev/null) + # If curl exists download file if [ "$(basename ${curlpath})" == "curl" ]; then # trap to remove part downloaded files @@ -198,8 +193,8 @@ fn_install_menu() { options=$4 # Get menu command for menucmd in whiptail dialog bash; do - if [ -x $(which ${menucmd}) ]; then - menucmd=$(which ${menucmd}) + if [ -x $(command -v ${menucmd}) ]; then + menucmd=$(command -v ${menucmd}) break fi done diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index c0d6d0b19..1b2b744e8 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -65,13 +65,8 @@ fn_bootstrap_fetch_file(){ mkdir -p "${local_filedir}" fi # Defines curl path - curl_paths_array=($(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl) - for curlpath in "${curl_paths_array}" - do - if [ -x "${curlpath}" ]; then - break - fi - done + curlpath=$(command -v curl 2>/dev/null) + # If curl exists download file if [ "$(basename ${curlpath})" == "curl" ]; then # trap to remove part downloaded files @@ -193,8 +188,8 @@ fn_install_menu() { options=$4 # Get menu command for menucmd in whiptail dialog bash; do - if [ -x $(which ${menucmd}) ]; then - menucmd=$(which ${menucmd}) + if [ -x $(command -v ${menucmd}) ]; then + menucmd=$(command -v ${menucmd}) break fi done diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 7f327dc13..bd36cf34c 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -65,13 +65,8 @@ fn_bootstrap_fetch_file(){ mkdir -p "${local_filedir}" fi # Defines curl path - curl_paths_array=($(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl) - for curlpath in "${curl_paths_array}" - do - if [ -x "${curlpath}" ]; then - break - fi - done + curlpath=$(command -v curl 2>/dev/null) + # If curl exists download file if [ "$(basename ${curlpath})" == "curl" ]; then # trap to remove part downloaded files @@ -193,8 +188,8 @@ fn_install_menu() { options=$4 # Get menu command for menucmd in whiptail dialog bash; do - if [ -x $(which ${menucmd}) ]; then - menucmd=$(which ${menucmd}) + if [ -x $(command -v ${menucmd}) ]; then + menucmd=$(command -v ${menucmd}) break fi done