aboutsummaryrefslogtreecommitdiff
path: root/scripts/pd-diff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-09-04 08:47:24 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-09-04 08:47:24 +0000
commit29f4e98cbbcb5f061bea5079582fe9c405f19d18 (patch)
tree45f090b56e22e8e403693b65727a9cd84a1fef40 /scripts/pd-diff
parent238cd24e9a5870bff39d7775c6b4d1f9eef58219 (diff)
changed the non-portable "tail +2" to a hopefully more portable sed-script;
use $() instead of ``; generally use ${VAR} rather than $VAR; svn path=/trunk/; revision=10276
Diffstat (limited to 'scripts/pd-diff')
-rwxr-xr-xscripts/pd-diff33
1 files changed, 19 insertions, 14 deletions
diff --git a/scripts/pd-diff b/scripts/pd-diff
index 4c8837e0..26db0a18 100755
--- a/scripts/pd-diff
+++ b/scripts/pd-diff
@@ -1,21 +1,26 @@
#!/bin/sh
-DATE=`date '+%Y-%m-%d_%H.%M.%S'`
+DATE=$(date '+%Y-%m-%d_%H.%M.%S')
TMPDIR=/tmp/pd-diff
#------------------------------------------------------------------------------
# FUNCTIONS
generate_tmp_filename () {
- echo $TMPDIR/`echo $1 | sed -e 's|/|_|g'`-$DATE
+ echo ${TMPDIR}/$(echo $1 | sed -e 's|/|_|g')-${DATE}
}
prep_for_diff () {
- TMPFILE=`generate_tmp_filename "$1"`
+ TMPFILE=$(generate_tmp_filename "$1")
+
+ # everything but the first line
+ # no "connect" lines
+ # remove position information
+
cat "$1" | \
- tail +2 | \
+ sed '2,$!d' | \
grep -v '#X connect ' | \
sed 's/\(#[XN] [a-z]+\) [0-9]+ [0-9]+/\1/' \
- > $TMPFILE
+ > ${TMPFILE}
}
#------------------------------------------------------------------------------
@@ -23,26 +28,26 @@ prep_for_diff () {
if [ $# -ne 2 ]; then
echo "ERROR: Invalid number of arguments ($#)"
- echo "Usage: $0 FILE FILE"
+ echo "Usage: $0 FILE1 FILE2"
else
- if [ ! -d $TMPDIR ]; then
- mkdir $TMPDIR
+ if [ ! -d ${TMPDIR} ]; then
+ mkdir ${TMPDIR}
fi
- TMP1=`generate_tmp_filename "$1"`
- TMP2=`generate_tmp_filename "$2"`
+ TMP1=$(generate_tmp_filename "$1")
+ TMP2=$(generate_tmp_filename "$2")
prep_for_diff "$1"
prep_for_diff "$2"
# diff of everything except "#X connect"'s
- diff -uw "$TMP1" "$TMP2"
+ diff -uw "${TMP1}" "${TMP2}"
- file1count=`grep -v '#X connect ' "$1" | wc -l`
- file2count=`grep -v '#X connect ' "$2" | wc -l`
+ file1count=$(grep -v '#X connect ' "$1" | wc -l)
+ file2count=$(grep -v '#X connect ' "$2" | wc -l)
if [ $file1count -ne $file2count ]; then
echo "---------------------------------------------------------"
- echo Connections differ: $file1count vs. $file2count
+ echo Connections differ: ${file1count} vs. ${file2count}
fi
fi