Просмотр исходного кода

Corrected code to check if command exists

Daniel Gibbs 11 лет назад
Родитель
Сommit
3a93b739f2
2 измененных файлов с 5 добавлено и 5 удалено
  1. 2 2
      functions/fn_check_tmux
  2. 3 3
      functions/fn_details_distro

+ 2 - 2
functions/fn_check_tmux

@@ -2,11 +2,11 @@
 # LGSM fn_check_tmux function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 210115
+# Version: 140215
 
 # Checks if tmux is installed as too many users do not RTFM or know how to use Google.
 
-if [ -z $(command -v tmux) ]; then
+if [ -z "$(command -v tmux)" ]; then
 	fn_printfailnl "Tmux not installed"
 	sleep 1
 	fn_scriptlog "Tmux is not installed"

+ 3 - 3
functions/fn_details_distro

@@ -2,7 +2,7 @@
 # LGSM fn_details_distro function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 120215
+# Version: 140215
 
 # Description: Variables providing useful info on the Operating System such as disk and performace info.
 # Used for fn_details, fn_debug and fn_email.
@@ -11,7 +11,7 @@
 # Returns architecture, kernel and distro/os.
 arch=$(uname -m)
 kernel=$(uname -r)
-if [ -z $(command -v lsb_release) ]; then
+if [ -n "$(command -v lsb_release)" ]; then
 	os=$(lsb_release -s -d)
 elif [ -f /etc/debian_version ]; then
 	os="Debian $(cat /etc/debian_version)"
@@ -27,7 +27,7 @@ glibcv=$(ldd --version |grep ldd|awk '{print $NF}')
 
 # tmux version
 # e.g: tmux 1.6
-if [ -z $(command -v tmux) ]; then
+if [ -z "$(command -v tmux)" ]; then
 	tmuxv="\e[0;31mNOT INSTALLED!\e[0m"
 elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:]|tail -c 3)" -lt "16" ]; then
 	tmuxv="$(tmux -V) (>= 1.6 required for console log)"