bash : ttsScript.sh

#!/bin/sh

usage () {
echo "
Usage: 
$0 --name \"TTS-TNM@1-PG\" --page 1-2 
" >&2; exit 1
}

while [ $# -gt 0 ]; do
	case "$1" in
		--name) NAME="$2"; shift;;
		--page) PAGE="$2"; shift;;
		--) shift; break;; -*) usage ;; *) break ;;
	esac; shift 
done
[ "$NAME" = "" -o "$PAGE" = "" ] && usage

NAMEPOXIS=$(echo "$NAME" | sed 's/ /\\ /g')

IFS='-' read -r -a PAGEA <<< "$PAGE"
#echo ${PAGEA[@]}
startPG=${PAGEA[0]}
endPG=${PAGEA[1]}

NAMEA=()

for (( p=$startPG; p<=$endPG; p++)) 
do
	NAMEPAGE="$NAME$p"
	NAMEPOXISPAGE="$NAMEPOXIS$p"
	NAMEA+=($NAMEPAGE)
	cmd="ttsTXT.sh --name \"${NAMEPAGE}\""
	echo $cmd; eval $cmd

	cmd="mkdir -p \"${NAMEPAGE}/\" "
        echo $cmd; eval $cmd

        cmd="mv -f ${NAMEPOXISPAGE}-0*.aiff \"${NAMEPAGE}/\" "
        echo $cmd; eval $cmd
        cmd="mv -f ${NAMEPOXISPAGE}-all.mp3 \"${NAMEPAGE}/\" "
        echo $cmd; eval $cmd
        cmd="cp -f \"${NAMEPAGE}-all.aiff\" \"${NAMEPAGE}/\" "
        echo $cmd; eval $cmd
        cmd="mv -f \"${NAMEPAGE}_tts.txt\" \"${NAMEPAGE}/\" "
        echo $cmd; eval $cmd
done 

#echo ${NAMEA[@]}

exit