mirror of https://gerrit.osmocom.org/osmo-dev
find the terminal once and abort if missing
Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
This commit is contained in:
parent
d865c97ec4
commit
4d7072cc2d
|
@ -34,18 +34,30 @@ fi
|
|||
logdir="current_log"
|
||||
mkdir -p "$logdir"
|
||||
|
||||
find_term() {
|
||||
# Find a terminal program and write to the global "terminal" variable
|
||||
local programs="urxvt xterm"
|
||||
local program
|
||||
for program in $programs; do
|
||||
terminal="$(which $program)"
|
||||
[ -n "$terminal" ] && return
|
||||
done
|
||||
|
||||
# No terminal found
|
||||
echo "ERROR: Couldn't find terminal program! Looked for: $programs"
|
||||
exit 1
|
||||
}
|
||||
|
||||
term() {
|
||||
title="$2"
|
||||
if [ -z "$title" ]; then
|
||||
title="$(basename $@)"
|
||||
fi
|
||||
terminal="$(which urxvt || which xterm)"
|
||||
if ! which $terminal; then
|
||||
echo "CANNOT FIND XTERM PROGRAM"
|
||||
fi
|
||||
exec $terminal -title "CN:$title" -e sh -c "export LD_LIBRARY_PATH='/usr/local/lib'; $1; echo; while true; do echo 'q Enter to close'; read q_to_close; if [ \"x\$q_to_close\" = xq ]; then break; fi; done"
|
||||
}
|
||||
|
||||
find_term
|
||||
|
||||
sudo tcpdump -i $dev -n -w current_log/$dev.single.pcap -U not port 22 &
|
||||
sudo tcpdump -i lo -n -w current_log/lo.single.pcap -U not port 22 &
|
||||
|
||||
|
|
Loading…
Reference in New Issue