[clug] Bashism desired

Andrew Janke a.janke at gmail.com
Tue Mar 12 00:44:50 MDT 2013


On 12 March 2013 16:37, steve jenkin <sjenkin at canb.auug.org.au> wrote:
> ## then edit the 'echo' into a mv, knowing its safe
> #
> for f in prefix*.pdf
> do echo $f; mv $f "newdir/newprefix_${f#prefix}_${f%.pdf}.pdf"
> done ## Note removal of 'less' or 'head' YMMV

I could be wrong but this sounds like a really long way to write this:

   $ mmv 'prefix*.pdf' 'newdir/newprefix_#1.pdf'

mmv will refuse to do things if there are collisions.


a


More information about the linux mailing list