title: linux command line rename all files with supplied argument
body: <p>trying to rename all files in a directory to <code>$arg[1] + number of file</code>.</p>
  
  <p>for example these files:</p>
  
  <pre><code>gfdgfdh.jpg  
  fgdsyugfs.jpg  
  gfyudsfuds.jpg  
  </code></pre>
  
  <p>will become the following when i do <code>sh myscript.sh dog</code> at the command line:</p>
  
  <pre><code>dog0.jpg
  dog1.jpg
  dog2.jpg
  </code></pre>
  
  <p>Here is the code I have so far, the regex works because if it try the <code>rename</code> command on one file from the command line it works.</p>
  
  <pre><code>#! /bin/sh
  COUNTER=0
  PREFIX=$1
  for i in *.jpg
  do
          rename 's/.*[^.jpg]/${PREFIX}${COUNTER}/' $i
          COUNTER=COUNTER+1
  done
  </code></pre>
  
  <p>The error I get is </p>
  
  <pre><code>Global symbol "$PREFIX" requires explicit package name at (eval 1) line 1.
  </code></pre>