Skip to content

Instantly share code, notes, and snippets.

@JoshuaChi
Created January 2, 2016 09:35
Show Gist options
  • Save JoshuaChi/39a6787c0f06a51f96ec to your computer and use it in GitHub Desktop.
Save JoshuaChi/39a6787c0f06a51f96ec to your computer and use it in GitHub Desktop.
Shell Multi Process
#!/bin/bash
set -m # Enable Job Control
WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
for i in `seq 8`; do # start 8 jobs in parallel(e.g. 8 cores)
//sh example.sh
done
# Wait for all parallel jobs to finish
while [ 1 ]; do fg 2> /dev/null; [ $? == 1 ] && break; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment