title: Bash loop script for incremental files
body: <p>wrote a bash script to create empty files a certain times when executed. After the first execution, it returns a syntax error &amp; seems to infinitely execute. Please what is my error?</p>
  <pre class="lang-sh prettyprint-override"><code>/bin/bash
  #Create loop for incremental files
  
  counter=1
  if (ls -f sam*.txt)2&gt;/dev/null;
  then
          max=$(ls -F sam*.txt)
          while ((counter&lt;=5))
          do
                ((max++))
                touch sam$max.txt
                ((counter))
          done
  else
          touch sam{1..10}.txt
  fi
  </code></pre>