Skip to content

Instantly share code, notes, and snippets.

@sleexyz
Created November 11, 2016 22:23
Show Gist options
  • Select an option

  • Save sleexyz/06edd333d4597db04e592f9083a6674e to your computer and use it in GitHub Desktop.

Select an option

Save sleexyz/06edd333d4597db04e592f9083a6674e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# example:
#
# > ./together "foo" "bar" "baz"
#
# runs foo, bar, baz as child processes
# ctrl-c will kill all
PID="$$"
trap "pkill -P $PID" SIGINT SIGTERM EXIT
for var in "$@"
do
$var &
done
cat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment