#!/bin/sh tmp=/tmp/`basename $0`-$$ check_file () { ./soxi -a $1 > $tmp.comments cmp $tmp.comments $2 || exit 1 } check () { f=$1; shift : > $tmp.expected while [ $# != 0 ]; do echo "$1" >> $tmp.expected shift done check_file $f $tmp.expected } com0="Processed by SoX" com1="foo bar" com2="bar foo" ./sox monkey.au $tmp.au # Apply default comment check $tmp.au "$com0" cp $tmp.au $tmp.comment.au cat > $tmp.i << . TITLE=First Track ARTIST=A Band ALBUM=A Collection Of Songs TRACKNUMBER=01 . ./sox monkey.au --comment-file $tmp.i $tmp.comments.au check_file $tmp.comments.au $tmp.i ./sox monkey.au --comment= $tmp.au # Don't apply default comment check $tmp.au ./sox monkey.au --add-comment "$com1" $tmp.au check $tmp.au "$com1" ./sox $tmp.comment.au --add-comment "$com1" $tmp.au check $tmp.au "$com0" "$com1" ./sox monkey.au --add-comment "$com1" --add-comment "$com2" $tmp.au check $tmp.au "$com1" "$com2" ./sox $tmp.comment.au --add-comment "$com1" --add-comment "$com2" $tmp.au check $tmp.au "$com0" "$com1" "$com2" ./sox $tmp.comments.au --comment= $tmp.au check $tmp.au ./sox $tmp.comments.au --comment "$com1" $tmp.au check $tmp.au "$com1" ./sox $tmp.comments.au --add-comment "$com1" $tmp.au cp $tmp.i $tmp.j echo "$com1" >> $tmp.j check_file $tmp.au $tmp.j ./sox $tmp.comments.au --add-comment "$com1" --add-comment "$com2" $tmp.au echo "$com2" >> $tmp.j check_file $tmp.au $tmp.j # FIXME: smp aiff mp3 ./sox $tmp.comments.au $tmp.flac ./sox $tmp.flac $tmp.sf ./sox $tmp.sf $tmp.ogg ./sox $tmp.ogg $tmp.sndt ./sox $tmp.sndt $tmp.sox ./sox $tmp.sox $tmp.au check_file $tmp.au $tmp.i rm -f $tmp.* exit 0