On Thu, May 20, 2004 at 04:25:34PM +0200, Matthias Czapla wrote:
> On Thu, May 20, 2004 at 10:02:00AM -0400, Jeff Elkins wrote:
> > I'm trying to automate this:
> > 
> > #!/bin/sh
> > 
> > for i in *; do
> >         if test -f $i; then
> > 
> >     fi
> > done
> > 
> > which works, but gives me: filename.mp3.wav - anyway to end up with 
> > filename.wav?
> 
> Yes:
> 
> mpg123 -s $i | sox -t raw -r 44100 -s -w -c 1 - \
> -t wav -r 8000 -w -c 1 "`echo $i | sed -e 's/mp3$/wav/'`"

Quoted correctly:

  "`echo "$i" | sed -e 's/mp3$/wav/'`"

A much simpler version of that if you know that $i ends with .mp3 is:

  "${i%.mp3}.wav"

Cheers,

-- 
Colin Watson                                  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to