title: Bash/sed: No such file or directory
body: <p>I have a script called script.sh:</p>
  
  <pre><code>FILE=$1
  sed -i.bak "s|needle|pin|g" $FILE
  </code></pre>
  
  <p>If I run it like this:</p>
  
  <pre><code>bash ./script.sh /var/www/path/to/file
  </code></pre>
  
  <p>I get this response:</p>
  
  <pre><code>: No such file or directoryth/to/file
  </code></pre>
  
  <p>If I run <code>sed</code> by itself, passing in the same path:</p>
  
  <pre><code>sed -i.bak "s|needle|pin|g" "/var/www/path/to/file"
  </code></pre>
  
  <p>It works fine (even substituting the values correctly).</p>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>Bonus observation</strong>: I'm assuming it's telling me the entry path is wrong but it's hard to tell because it says ": No such file or directoryth/to/file", which indicates to me that something else is wrong. Maybe something carriage-return related?</p>