parallel-sh

Build Status CI GitHub license

parallel-sh was heavily inspired by Rust Parallel parallel parallelzing 'otherwise non-parallel command-line tasks.' But instead of recreating the full functionality of GNU Parallel parallel-sh will only execute (lines of) commands in the platform's preferred shell ('sh -c' on Unix systems, and 'powershell.exe -c' on Windows) in separate threads.

Output (stdout and stderr) of each child process is stored and printed only after the child exits.

Options

``` parallel-sh 0.1.0 Execute commands in parallel

USAGE: parallel-sh [FLAGS] [OPTIONS] [clijobs]...

FLAGS: --dry-run Perform a trial run, only print what would be done (with -vv) --halt-on-error Stop execution if an error occurs in any thread -h, --help Prints help information -q, --quiet Do not print parallel-sh warnings -v, --verbose Sets the level of verbosity -V, --version Prints version information

OPTIONS: -f, --file Read commands from file (one command per line) -l, --log Log output to file -j, --jobs Number of parallel executions

ARGS: ... ```

Preference

  1. Pass commands as arguments: parallel-sh "sleep 1 && echo 1" "sleep 2 && echo 2"

  2. Pass a file with one command (-line) per line: ``` parallel-sh -f /tmp/commands

    $ cat /tmp/commands sleep 1 && echo 1 sleep 2 && echo 2 ```

  3. Pass commadn via stdin: echo -e 'sleep 1 && echo 1\nsleep 2 && echo 2' |parallel-sh