title: Using option flag with condition (shell script)
body: <p>I have this command inside my shell script file:</p>
  <pre><code>docker exec dev-wordpress $phpunitPath \
    --configuration $configurationPath \
    --testsuit $testsuit \
    --group $group \
    --testdox
  </code></pre>
  <p>It is working if I set the 'testsuit' and the 'group' as command line options.
  The 'testsuit' and 'group' options should be used only if those variables has value.
  Same issue with 'testdox' is solved with 'if-else' but it is not a good way when I want to do the same with 3 different options.</p>
  <p><strong>How can I avoid the '--group' option if I don't have value in $group variable?</strong></p>
  <pre><code>#!/bin/zsh
  phpunit=&quot;/var/www/html/wp-content/plugins/irea/api/src/vendor/bin/phpunit&quot;
  configuration=&quot;/var/www/html/wp-content/plugins/irea/api/tests/phpunit.xml&quot;
  testdox=
  filter=
  testsuite=
  group=
  
  while [ &quot;$1&quot; != &quot;&quot; ]; do
      case $1 in
          --group )       shift
                          group=&quot;--group $1&quot;
                          ;;
          --testsuite )   shift
                          testsuite=&quot;--testsuite $1&quot;
                          ;;
          --filter )      shift
                          filter=&quot;--filter $1&quot;
                          ;;
          --testdox )     testdox=&quot;--testdox&quot;
                          ;;
      esac
      shift
  done
  
  docker exec irea-wordpress $phpunit \
    --configuration $configuration \
    $testsuite \
    $group \
    $filter \
    $testdox
  </code></pre>