rename file names work in command prompt but not in bash script
<p>I'm trying to rename commands in a bash script. If I run for example:</p>

<pre><code>echo /home/scientist/mySalesData/campaignData_1482386214.24417.csv  | sed 's/\(.*\)\(_.*\)/mv \"&amp;" \"\1.csv\"/' | bash   
</code></pre>

<p>It works fine and gives me campaignData.csv in the directory <code>/home/scientist/mySalesData/</code> .</p>

<p>However, if I put this in a bash script as follows:</p>

<pre><code>for f in /home/scientist/SalesData/*; do
if [ -f "$f" ]; 
  cp "$f" /home/scientist/SalesForce/SalesData/Backups/                                                                
  echo $f$ | sed 's/\(.*\)\(_.*\)/mv \"&amp;" \"\1.csv\"/' | bash |        
fi 
done 
</code></pre>

<p>I get: </p>

<pre><code>mv: cannot stat '/home/scientist/SalesData/campaignData_1482386214.24417.csv$': No such file or directory          
</code></pre>

<p>Any help would be much appreciated!</p>