From ff3dfc91aebd454323a25baf6ffd8c9145747564 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 6 Apr 2023 17:25:36 +0800 Subject: WIP --- bin/unix/timer.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bin/unix/timer.sh') diff --git a/bin/unix/timer.sh b/bin/unix/timer.sh index 3abe701..152d828 100755 --- a/bin/unix/timer.sh +++ b/bin/unix/timer.sh @@ -1,6 +1,9 @@ #! /bin/bash # Ref: https://superuser.com/questions/611538/611582#611582 +exec 3>&1 +exec 1>/dev/tty + SIGNAL=${1:-SIGTERM} COMMAND="$2" @@ -75,6 +78,8 @@ timer() { done } +trap 'exec 1>&3; echo $count; send-notify foo' EXIT KILL TERM STOP + while [ $count -lt $SET ]; do [ $stop = true ] && sleep 0.3 && continue timer -- cgit v1.2.3-70-g09d2