#! /bin/bash -u

# Program takes a list of numbers from user and downloads the specified SBFC Epi

sodes.

#

#

#

function echoError {

echo "$@" 1 >& 2

exit 1

}

begin = "http://traffic.libsyn.com/superbestfriendcast/SBFC $x "

end = ".mp3?_=2"

file = "$1"

if [ -z $file ] ; then echoError 'Usage: sbfcDown.sh <fileName>'

elif [ ! -e $file ] ; then echoError "Error: \" $file \" does not exist."

elif [ -d $file ] ; then echoError "Error: \" $file \" is a directory."

elif [ ! -r $file ] ; then echoError "Error: You do not have read permission for \" $file \" ."

fi

for x in $ ( cat $file ) ; do

download = " $begin $x $end "

if [ ! -e "SBFC $x $end " ] && [ ! -e "SBFC $x " ".mp3" ] ; then

wget " $download "

sleep 3

mv "SBFC $x $end " "SBFC $x " ".mp3"

fi