title: How to check for the existence of a second argument
body: <p>I need to update this bash function I use for doing things with git:</p>
  
  <pre><code>push() {
    a=$1
    if [ $# -eq 0 ]
      then
        a=$(timestamp)
    fi
    # ... do stuff
  }
  </code></pre>
  
  <p>but I don't know how this line works</p>
  
  <pre><code> if [ $# -eq 0 ]
  </code></pre>
  
  <p>I need to check for a first argument and then I need to check for a second argument. </p>
  
  <p>So there will be 2 if statements.</p>
  
  <p>How can I update this and how does this line work</p>
  
  <pre><code> if [ $# -eq 0 ]
  </code></pre>