2
我想創建一個小腳本來檢查程序是否安裝。我與TMUX努力,...Bash,...檢查程序是否安裝,使用bash腳本
`tmux --help` | grep "tmux: command not found" &> /dev/null
if [ $? == 1 ]; then
echo "tmux is not installed"
exit
fi
安裝TMUX後,我得到:
usage: tmux [-2lquvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
tmux is not installed
如果未安裝的程序,appair字符串 「TMUX:命令未找到」。這可以解釋爲什麼我grep輸出tmux --help
命令。是否檢查tmux是否安裝正確?
腳本alwais回聲「未安裝tmux」。即使我安裝了tmux。它出什麼問題了?
您不想在'tmux --help'附近執行'tmux --help',然後嘗試執行返回的幫助字符串作爲命令。 –
哈哈。你是完全正確的 – sensorario