I don't know if it's optimal but I usually do: ```sh #!/usr/bin/env sh terminate() { exit 0 } trap terminate TERM sleep infinity & wait ```