Trap signals and other events.
Synopsis
trap [COMMAND] [SIGNAL]...
Description
Set a command to be executed when the shell receives a signal. Runs in the just-bash WASM shell inside SLICC.
Signals
EXIT Execute on shell exit.
INT Execute on interrupt (Ctrl+C).
TERM Execute on terminate signal.
ERR Execute when a command fails.
Examples
$ trap "echo bye" EXIT
Print "bye" when the shell exits.
$ trap "rm /tmp/lockfile" EXIT
Clean up a lock file on exit.
See Also
kill, signal