Quote:
Got a file containing a list of files (using "ls > file").
Want to give the list of files one by one to wma2ogg.sh (which can be called
using "wma2ogg.sh [file]" only using one file at a time).
Can anyone suggest how this could be done using bash scripting or whatever?
|
Here is a somewhat shorter answer:
Code:
for f in `cat file`; do wma2ogg.sh $f; done
This command (works in bash) runs wma2ogg.sh once for every line in file. The line content is placed into $f.
Here is another one:
Code:
xargs -a file -L1 wma2ogg.sh
It will do the same thing as the above command, but is not shell-dependent, since xargs is a program, not a shell construct (like for; do; done). In other words, it works with other shells too, like tcsh.
Both these commands assume that your input file is called 'file' (without the quotes), and that wma2ogg.sh is available in your PATH. If the last is not true, prepend the correct path to the wma2ogg.sh command, like /path/to/program/wma2ogg.sh or, if wma2ogg.sh is in the current directory, ./wma2ogg.sh