Skip to content

Instantly share code, notes, and snippets.

@nexus166
Created October 11, 2019 17:01
Show Gist options
  • Select an option

  • Save nexus166/1bdde93fb2076249ba803792b9e4e6d0 to your computer and use it in GitHub Desktop.

Select an option

Save nexus166/1bdde93fb2076249ba803792b9e4e6d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function w8() {
for p in "${@}";
do
wait -n "${p}" 2> /dev/null &
done;
wait -n
}
function _j() {
TODO="${1}";
TARGETs=(${@:2});
pids=();
for j in "${TARGETs[@]}";
do
pids+=($!);
eval "${TODO} ${j}" &
done;
w8 "${pids[@]}"
}
function j() {
[[ ! -z "${*}" ]] && ( _j "${@}" )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment