[GLLUG] Syntax question
Stanley C. Mortel
mortel at cyber-nos.com
Sat Mar 1 17:13:55 EST 2008
OK, I'm trying to use lame to convert .wav files to .mp3 files. Without an
output file argument it names the thing 1.wav.mp3 when I want it to be
1.mp3. So I've been trying to use "basename" to fix this but that command
seems to embed a carraige return that I can't get rid of. Here is the script:
#!/bin/bash
for f in *.wav ;
do
g = | basename $f .wav ;
echo $g.mp3
lame $f $g.mp3 ;
done
The echo returns
1
.mp3
then lame converts 1.wav into .mp3.
I've tried doing it without the "g =" line but can't seem to find any
syntactically correct way to express
lame $f "| basename $f .wav".mp3
which is why I tried the "g =" line. Quotes (single or double) don't
work, nor do parentheses or braces or brackets. Is there some way to keep
the line
g = | basename $f .wav ;
from embedding a carraige return in the value of $g ???
"basename" doesn't seem to be all that well documented out there, and it is
basename rather than the "g =" line itself, since
g = h
echo $h.mp3
returns g.mp3, which is what I want.
Thanks in advance.
****************************
Stan Mortel
mortel at cyber-nos.com
****************************
More information about the linux-user
mailing list