Last active
February 27, 2023 16:27
-
-
Save yash1610/bd3e4121e6dc0152689c1a85e21aff9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# trap signal | |
stopwatch() { | |
now=$(date +%s)sec | |
while : | |
do | |
printf "\r%s" $(TZ=UTC date --date now-$now +%H:%M:%S.%N) | |
done | |
} | |
trap stopwatch SIGINT SIGTERM | |
echo "pid is $$" | |
while : | |
do | |
sleep 60 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment