title: Bash create while loop to remove all files within a directory
body: <p>Trying to create a while loop to remove 8 files from a specified test folder. I keep getting the error <code>no such file or directory</code> even though I am positive I am in the right folder because I can use the <code>ls</code> command to see the files... Anyways here is what I have</p>
  
  <pre><code>#!/bin/bash
  
  var=(`ls ~/Random/Unit1/Test`)
  x=${#var[@]}
  i=0
  
  while [ $i -lt $x ] ; do
      rm $var                   # this line is incorrect and needs changing
      ((i++))
  done
  </code></pre>