[arch-general] a bit more script

John K Pate j.k.pate at sms.ed.ac.uk
Tue Mar 20 10:52:34 EDT 2012


> Thanks to  John K Pate  but i dont at the moment have time to sit and
> digest heaps of variables i just need to solve this one problem  . 
> 

You want to be able to change "img_0004.jpg" to "img_0004_s.jpg", right?
You can use the built-in string replace functionality of bash to achieve
this (described in the first hit of that google search):

$ f=img_0004.jpg
$ echo $f
img_0004.jpg
$ echo ${f/.jpg/_s.jpg}
img_0004_s.jpg

==
John K Pate http://homepages.inf.ed.ac.uk/s0930006/


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the arch-general mailing list