title: testing for command line args in bash
body: <p>I am testing to see if the first argument to my script is <code>--foo</code></p>
  
  <pre><code>if [ $# &gt; 1 ]
  then
      if [[ "$1" = "--foo" ]]
      then
          echo "foo is set"
          foo = 1
      fi
  fi
  
  if [[ -n "$foo"]]
  then
      #dosomething
  fi
  </code></pre>
  
  <p>Can someone pleaset tell me what is the bash way of testing if <code>--foo</code> is present as one of the arguments, not necessarily the first one?</p>