title: Why does the output from my script say "mv: command not found" but not when I run it on the shell directly?
body: <p>I wrote a small script that should rename some files in a directory for me.</p>
  
  <pre><code>#!/bin/bash
  
  a=1
  for i in *.jpg ; do
          new=$(printf "%04d.jpg" "$a")
          mv "$i" "$new"
          let a=a+1
  done
  
  #end of file
  </code></pre>
  
  <p>After running the script is says this: "mv: command not found"</p>
  
  <p>How come there are no error outputs when I run the code directly on the shell like this:</p>
  
  <pre><code>for i in *.jpg ; do new=$(printf "%04d.jpg" "$a") ; mv $i $new ; let a=a+1 ; done
  </code></pre>