I am trying to create a little script that check if a program is installed or not. I am trying with tmux, ...
`tmux --help` | grep "tmux: command not found" &> /dev/null
if [ $? == 1 ]; then
echo "tmux is not installed"
exit
fi
After installation of tmux, I get:
usage: tmux [-2lquvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
tmux is not installed
If a program is not installed, appair the string "tmux: command not found". This could explain why I grep output of tmux --help
command. Is a correct way to check if tmux is installed or not?
The script alwais echoes "tmux is not installed". Even if I install tmux. What's wrong with it?