-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpmon
executable file
·43 lines (40 loc) · 946 Bytes
/
gpmon
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
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh
# This script shows all the plots in the current working directory.
# The script takes one optional argument, which is either
# the integer `0` to enable interactive plots
# that do not update automatically or
# the positive integer `n` to enable noninteractive plots
# that update automatically every `n` seconds.
case "$#" in
0)
t=0
;;
1)
t="$1"
;;
*)
echo "Too many arguments." >&2
exit 1
;;
esac
s='EXIT HUP INT QUIT PIPE TERM' && \
trap wait CONT && \
d=$(mktemp -d) && \
trap 'trap - $s && rm -fr "$d" && kill -- "-$$" 2> /dev/null' $s && \
for x in *.gp
do
( y="$d/$(basename "$x")" && \
{ echo 'set terminal wxt noraise' && \
sed '/^set \(terminal\|output\)/d' "$x" && \
if test "$t" -gt 0
then
echo "pause $t" && \
echo reread
else
echo 'pause mouse close'
fi
} > "$y" && \
gnuplot "$y" 2> /dev/null
) &
done && \
wait