Skip to content

Instantly share code, notes, and snippets.

@yash1610
Last active February 27, 2023 16:27
Show Gist options
  • Save yash1610/bd3e4121e6dc0152689c1a85e21aff9f to your computer and use it in GitHub Desktop.
Save yash1610/bd3e4121e6dc0152689c1a85e21aff9f to your computer and use it in GitHub Desktop.
#!/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