Skip to content

Instantly share code, notes, and snippets.

@orbekk
Created August 7, 2013 22:45
Show Gist options
  • Save orbekk/6179626 to your computer and use it in GitHub Desktop.
Save orbekk/6179626 to your computer and use it in GitHub Desktop.
Bash Challenge #1
Write a script pardo.sh. It should take a target number of processes N, and a list of commands. The commands should be executed in parallel on up to N processes.
Usage: pardo.sh NUM_PROCESSES COMMAND...
Test as follows:
time /tmp/pardo.sh 2 "sleep 2" "sleep 4" "sleep 4" "sleep 2"
This should take 6 seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment