[sclug] Bash scripting help needed
Bob Dunlop
bob.dunlop at xyzzy.org.uk
Wed Apr 22 08:02:04 UTC 2009
Hi,
> You don't need the first test (for $1) above - if it is null then $2 will
> be too; as others have pointed out, you need spaces around the "[" and "]".
To be pedantic someone could call the script as script "" outputfile
Also the file list expanding loop seems redundant in the current version.
Just expand the filelist directly in the shnjoin command list.
Here's my simpler version.
#!/bin/bash
if [ $# -ne 2 -o -z "$1" -o -z "$2" ]
then
echo "Use: command codectype outputfilename"
exit 1
fi
echo "codec type=$1"
echo "output file=$2"
# Join all the files in the current directory together
shnjoin -o $1 *
#rename the result as asked
mv joined.$1 $2.$1
Then I don't like a script that joins everything in a directory into one
file in the same directory. Run it a second time and you'll end up in a
right mess.
I'd suggest making the choice of input files a little more selective.
Guessing that all input tracks are of the form ##.something I'd suggest.
shnjoin -o $1 [0-9][0-9].*
--
Bob Dunlop
More information about the Sclug
mailing list