title: How to set variable value with conditional in one line?
body: <p>Have this:</p>
  
  <pre><code>DATABASE_HOST=[ $# -le 3 ] &amp;&amp; $3 || '127.0.0.1';
  </code></pre>
  
  <p>But does not works. Is a bash script with 3 optional parameters: </p>
  
  <pre><code>db.sh user dbname hostname
  </code></pre>
  
  <p>I want to replace my old method:</p>
  
  <pre><code>if [ $# -le 3 ]
  then
      DATABASE_HOST=$3;
  else
      DATABASE_HOST='127.0.0.1';
  fi
  </code></pre>