gsgp/util/watchval

20 lines
364 B
Plaintext
Raw Normal View History

#!/bin/sh
value="$1"
cmd="$( dirname $0 )/getvalpath"
. "$( dirname $0 )/common"
if [ ! "$value" ]; then
echo "Usage: $0 VALUE" >&2
exit 3
fi
valpath=$( $cmd $value )
touch "$valpath"
# follow value until parent process (likely the screen session) dies, which will
# output the value each time it's updated
tail -f "$valpath" --pid=$PPID 2>/dev/null