Andrew Libby on 24 Nov 2005 19:25:54 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] bash script help


I'm not sure why it stopped working, but you might
try a version something like this:

prepend=$1;
shift;

for file in $*; do
    echo mv -v $file $prepend$file
done

It makes sense to me that it'd only work on one file, because
there's only ever a single file in $2 to process. 

As others have indicated, there's rename.

Andy


Art Alexion wrote:

>I have a script that used to work called prepend.filename.  It consists of
>
>#!/bin/bash
>
>for file in ${2}
>do
>mv -v $file ${1}$file
>done
>
>
>I used to be able to run it like this
>
>prepend.filename Chipmunks- *.mp3
>
>and it would prepend Chipmunks- to every mp3 file in the current working
>directory.  Now strangely, it works on one file, then exits.  Run it
>again and it works on the next file and exits again.  What went wrong?
>
>  
>
>------------------------------------------------------------------------
>
>___________________________________________________________________________
>Philadelphia Linux Users Group         --        http://www.phillylinux.org
>Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
>General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>  
>

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug