Skip to content

Instantly share code, notes, and snippets.

@chaspy
Created August 13, 2018 23:55
Show Gist options
  • Save chaspy/2d8889efec0f4592153ad507c4004baf to your computer and use it in GitHub Desktop.
Save chaspy/2d8889efec0f4592153ad507c4004baf to your computer and use it in GitHub Desktop.

Revisions

  1. chaspy created this gist Aug 13, 2018.
    13 changes: 13 additions & 0 deletions trap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/bin/bash

    touch /tmp/trap.$$

    trap 'echo "trapped"; rm /tmp/trap.$$; exit 1' 2

    while :
    do
    echo "loop"
    sleep 10
    done

    rm /tmp/trap.$$