commit e5da1b7b889e55630245fa44cd249202925a1fbe
parent 35489d061d485ec182346adf89cb2327bbc3647b
Author: sin <sin@2f30.org>
Date: Tue, 23 Feb 2016 13:26:07 +0000
Check if gnuplot is installed
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/sbm-plot b/sbm-plot
@@ -1,9 +1,15 @@
#!/bin/sh
+command -v gnuplot >/dev/null || {
+ echo gnuplot is not installed 1>&2
+ exit 1
+}
+
tmp=`mktemp`
while read line; do
echo "$line" >> "$tmp"
done < /dev/stdin
+
DATAFILE="$tmp" gnuplot << 'EOF'
set term png x040418 xffba00
set autoscale
@@ -14,4 +20,5 @@ datafile=system("echo $DATAFILE")
plot datafile using ($1/1000/1000) with lines title "RX Mbps", \
datafile using ($2/1000/1000) with lines title "TX Mbps"
EOF
+
rm -f "$tmp"