The single ampersand & is used to run commands asynchronously in the background. From the bash docs: If a command is terminated by the control operator ‘&’, the shell executes the command asynchronously in a subshell. This is known as executing the command in the background, and these are referred to as asynchronous commands. The […]
Shell
The Bash trap command
Bash’s trap command is used to catch and react to signals sent to your shell. It’s similar to an event listener in the browser, or a pubsub topic subscriber. The typical use case is to run some kind of cleanup command when a process terminates, like this: The command above will run cleanup_job when it […]