trap

Execute a command upon an event. More information: <https://manned.org/trap.1posix>.

Install

All systems
curl cmd.cat/trap.sh
Debian Debian
apt-get install execline
Ubuntu
apt-get install execline
Alpine
apk add execline
image/svg+xml Kali Linux
apt-get install execline
Windows (WSL2)
sudo apt-get update sudo apt-get install execline
Docker
docker run cmd.cat/trap trap powered by Commando

Execute a command upon an event. More information: <https://manned.org/trap.1posix>.

  • List the commands and the names of the expected events:
    trap
  • Execute a command when a signal is received:
    trap 'echo "Caught signal SIGHUP"' HUP
  • Remove commands:
    trap - HUP INT

© tl;dr; authors and contributors