The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 01-02-2009
Christoph Spohr Christoph Spohr is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 205
Hi,

shell variables inside '' are not expanded. So here


Code:
mv $i `echo $i | sed 's/$myfile//'`

$myfile will not be substituted by "date '+ABC%Y%m%d'".

Either use "..." or no sed at all. Shell built-ins are enough. Try:

Code:
mv $i ${i/200[7-9][0-1][0-9][0-3][0-9]/}

HTH Chris