Catching signals in bash

You can catch signals in bash using trap:

#!/bin/bash

_handler() {
  echo "Wow!"
}

trap _handler SIGTERM

It can be useful for manipulating children processes or Docker containers started by a script.