Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Shell scripting help
Name: Hiran Date: April 12, 2003 at 14:22:25 Pacific OS: Debian CPU/Ram: AMD 900/128MB
Comment:
I'm trying to write a script to batch convert wavs to mp3s. So far I have this:
for file in `ls [Directory]` ; do lame -b 320 -q 0 $file.wav $file.mp3 done
But the problem seems to be that even though ls lists the full file name (w/ spaces and all), each name is being broken up with space as the token (I tried an echo $file to confirm this). I was thinking I could concatenate $file with some temp variable and then when $file has a ".wav" in it, do the conversion and then reinitialize the variable. If so, how do I check the last four characters of $file? Or is there a better way to do this? Thanks.
Name: David Perry Date: April 12, 2003 at 20:58:25 Pacific
Reply:
The rename command would be a big help to you if you want to remove spaces from file names.
0
Response Number 2
Name: danco Date: April 13, 2003 at 11:04:40 Pacific
Reply:
Hiran, I'm trying to do exactly this same thing -- did you find a simple solution yet? I found autolame and some other tools at http://www.mp3-converter.com/linux/ but I was hoping to find a simple script just like you have above. If you find a simple scripting solution, please let me know.
0
Response Number 3
Name: ramadog Date: April 13, 2003 at 18:54:39 Pacific
Reply:
Something like this should work
#!/bin/bash
for i in *.wav do NAME=`basename "$i" .wav` lame "$NAME".wav "$NAME".mp3 done
0
Response Number 4
Name: danco Date: April 13, 2003 at 20:50:38 Pacific
Summary: i need help with a shell script that passes a variable. why does this not work?: echo $`echo 1` i want this to produce the same result as echo $1 but instead of the first option given at the command...
Summary: Im starting to learn bash. i lvoe it. im trying to do something but want the easy way arround. I made this script: #!/bin/bash #Author = MrJake # #Desc = will display a chmod list # # #Created on Mon ...
Summary: hi guys, i really need some help asap. Im taking an OS class and we barely skimmed over Linux. We were asked a homework question that for the life of me i have no idea how to do. the qestion is... wri...