3 # requirements: sqlite3 binary
4 # usage: sqlite-dump-diff-util.sh <file1> <file2> <command with [1] and [2] as place holders>
5 # kdesvn-example: sqlite-dump-diff-util.sh %1 %2 kompare -c [1] [2]
6 # what it does: check if one of first two arguments is sqlite file, if so - create a dump of both and replace [1] and [2] with the dump files - else replace [1] and [2] with the unchanged first two arguments - execute the command
18 if file -b "$f1" "$f2" |
grep -i 'sqlite 3' >/dev
/null
; then
20 sqlite3
"$o1" .dump
> "$f1"
22 sqlite3
"$o2" .dump
> "$f2"
24 args
="${args//'[1]'/$f1}"
25 args
="${args//'[2]'/$f2}"
27 [ "$o1" != "$f1" ] && rm "$f1"
28 [ "$o2" != "$f2" ] && rm "$f2"