Skip to content

Instantly share code, notes, and snippets.

@nishanths
Last active January 22, 2023 14:41
Show Gist options
  • Save nishanths/6f00820e408cb18c361cfe4a1e5b79f6 to your computer and use it in GitHub Desktop.
Save nishanths/6f00820e408cb18c361cfe4a1e5b79f6 to your computer and use it in GitHub Desktop.
trap 'echo hello' INT
read
# Output:
#
# % bash trap_basic
# ^Chello
# ^Chello
# ^Chello
# ^Chello
# ^Chello
trap 'echo hello' INT
trap '' INT
read
# Output:
#
# % bash trap_null
# ^C^C^C^C^C^C^C
trap 'echo hello' INT
trap - INT
read
# Output:
#
# % bash trap_reset
# ^C
# %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment