Skip to content

Instantly share code, notes, and snippets.

@r10r
Created July 8, 2020 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r10r/eae7d1ec9e14f1064bd198a3ba056bdc to your computer and use it in GitHub Desktop.
Save r10r/eae7d1ec9e14f1064bd198a3ba056bdc to your computer and use it in GitHub Desktop.
Self terminate shell script after deadline.
#!/bin/sh
PID=$$
deadline() {
sleep $1
kill $PID
}
export deadline
deadline 2 &
while true; do
echo "waiting"
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment