-
Notifications
You must be signed in to change notification settings - Fork 0
/
printBTree.sh
executable file
·33 lines (29 loc) · 1.09 KB
/
printBTree.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash -
#===============================================================================
#
# FILE: dot.sh
#
# USAGE: ./dot.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Jianfeng Jia (), [email protected]
# ORGANIZATION: ics.uci.edu
# CREATED: 04/26/2015 22:31:20 PDT
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
[ $# -lt 1 ] && { echo "error: please provide at least one btree json file."; exit 1; }
for var in "$@"; do
output=${var}.svg
tmpDot=`mktemp -t .tree.dot.XXXX` || { echo "create tmp file failed" ; exit 1; }
python convertJson2Dot.py $var > $tmpDot
[ $? -eq 0 ] || { echo "convertJson2Dot failed, please validate your json file: $var"; exit 2;}
dot -Tsvg $tmpDot -o $output
[ $? -eq 0 ] || { echo "create graph from dot file failed : $var"; exit 3;}
echo "The graph of \"${var}\" is output to \"$output\""
done