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