removed which command as per shellcheck

command is a POSIX and will exclusivly use this moving forward. https://github.com/koalaman/shellcheck/wiki/SC2230
This commit is contained in:
Daniel Gibbs 2018-03-14 17:37:22 +00:00
parent ff009c22a8
commit bbcf07603d
7 changed files with 17 additions and 38 deletions

View File

@ -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 )

View File

@ -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}"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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