On Tue, Aug 12, 2003 at 08:04:14AM +0100, Richard Urwin wrote:
> > > but it isn't up to capitalising each word. The required command is
> > > something like:
> > > for $i in *.ogg do
> > > mv $i `echo $i|sed "s/\([_ ]\)\([a-z]\)/\1\u\2/g"`
> > > done
> > > The sed command is correct, but I get syntax errors on the 'for',
> > > maybe someone can jump in and correct me.
> >
> > If the filename has spaces in it you need to quote $i in the mv
> > command, i.e. 'mv "$i" ...'.
>
> True. but I couldn't get it to get that far. It complains that "mv" is
> unexpected. Something to do with the "for" syntax that I couldn't find
> the right mystical incantation for.
When I do for loops I do it like this:
for i in *.ogg
do
mv "$i" someothername.ogg
done
the main difference being that the first "i" is not a variable as you
have it written; I don't know if having "do" on a new line makes any
difference or not.
Todd
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com