[sclug] Bash script

Neil Haughton haughtonomous at googlemail.com
Wed Apr 22 20:14:28 UTC 2009


Bob,

Thanks for your help. I have adopted and amended your script and it works
perfectly. My final version is:

#!/bin/bash

if [ $# -ne 2 -o -z "$1" -o -z "$2" ]
then
       echo "Use: audoijoin.sh [codectype] [outputfilename]"
       echo eg audiojoin.sh mp3 LargeFileName
       exit 1
fi

echo "You have specified codec type=$1"
echo "You have specified output file=$2.$1"

#clean up first
rm joined.$1

# Join all the files in the current directory together, into joined.$1
shnjoin -o $1 *

#rename the result as asked
mv joined.$1 $2.$1


I'd like to say this is my first successful bash script, but there's not
much of my original left! But I'm happy, and I've learned quite a bit about
the subtleties of bash scripting. It's not VBA! :-)

Thanks

Neil.



More information about the Sclug mailing list