Consolidate multiple if statements in Ksh <p>How can I consolidate the following if statements into a single line?</p> <pre><code>if [ $# -eq 4 ] then if [ "$4" = "PREV" ] then print "yes" fi fi if [ $# -eq 3 ] then if [ "$3" = "PREV" ] then print "yes" fi fi </code></pre> <p>I am using ksh. </p> <p>Why does this give an error?</p> <pre><code>if [ [ $# -eq 4 ] &amp;&amp; [ "$4" = "PREV" ] ] then print "yes" fi </code></pre> <p>Error:</p> <blockquote> <p>0403-012 A test command parameter is not valid.</p> </blockquote>