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