title: Shell Script Too Many Arguments for if condition
body: <p>My current script does the following;</p>
  
  <p>It takes integer as a command line argument and starts from 1 to N , it checks whether the numbers are divisible by 3, 5 or both of them. It simply prints out Uc for 3, Bes for 5 and UcBes for 3,5. If the command line argument is empty, it does the same operation but the loop goes to 1 to 20.</p>
  
  <p>I am having this error "Too many arguments at line 11,15 and 19".</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#!/bin/bash
  
  if [ ! -z $1 ]; then
      for i in `seq 1 $1`
      do
          if [ [$i % 3] -eq 0 ]; then
              echo "Uc"
          elif [ i % 5 -eq 0 ]; then
              echo "Bes"
          elif [ i % 3 -eq 0 ] &amp;&amp; [ i % 5 -eq 0 ]
          then
              echo "UcBes"
          else
              echo "$i"
          fi
      done
  elif [ -z $1 ]
  then
      for i in {1..20}
      do
          if [ i % 3 -eq 0 ]
          then
              echo "Uc"
          elif [ i % 5 -eq 0 ]
          then
              echo "Bes"
          elif [ i % 3 -eq 0 ] &amp;&amp; [ i % 5 -eq 0 ]
          then
              echo "UcBes"
          else
              echo "$i"
          fi
      done
  else
      echo "heheheh"
  fi
  </code></pre>