title: Gzip no such file or directory error, still zips files
body: <p>I'm just learning shell scripting specifically in bash, I want to be able to use gzip to take files from a target directory and send them to a different directory. I enter directories in the command line. ext is for the extensions I want to zip and file will be the new zipped file. <strong>My script zips the files correctly</strong>, to and from the desired directories, <strong>but I get a no such file or directory error</strong>. How do I avoid this?</p>
  
  <p>Current code</p>
  
  <pre><code>cd $1
  
  for ext in $*; do
      for file in `ls *.$ext`; do
          gzip -c $file &gt; $2/$file.gz
      done 
  done
  </code></pre>
  
  <p>and my I/O</p>
  
  <pre><code>blackton@ltsp-amd64-charlie:~/Desktop/60256$ bash myCompress /home/blackton/Desktop/ /home/blackton/ txt
  ls: cannot access *./home/blackton/Desktop/: No such file or directory
  ls: cannot access *./home/blackton/: No such file or directory
  gzip: alg: No such file or directory
  gzip: proj.txt: No such file or directory
  </code></pre>