||08-27-2005 12:18 AM
Simple Shell Scripting Question
I am trying to run a program called "normalize" in a bash script. "normalize" normalizes a set of sound files so they have a comparable volume, which is handy when burning mix CD's for example. However, the program only looks at sound files in a particular directory, and for technical reasons, I need to run it on sound files across several directories. So I'm trying to use the following simple shell script to run the program on each filename in the output of 'ls -R':
# This is a shell script to facilitate batch normalization using Chris Vaill's command-line normalize program for *nix. For each subdirectory of the directory in which the program is run, it will enter that directory and normalize all the sound files in it.
for filename in 'ls -R'
/sw/bin/normalize --mix --verbose --verbose $filename
The output of this script is as follows:
/sw/bin/normalize: invalid option -- R
Usage: normalize [OPTION]... [FILE]...
Try `normalize --help' for more information.
I have almost no experience writing shell scripts, but my understanding is that what should happen is that the script should run 'ls -R', find all the filenames and run normalize on each of them. But somehow, "normalize" is getting the -R option passed to it that is meant for 'ls'. Is there a better way to do this, or am I basically on the right track but have to tweak my code? TIA.