You can split a command into multiple processes by specifying
a numeric argument after the ampersand: &[n].
This splits up a command with many arguments into
[n] separate jobs, each with 1/n of the argument list, or [n] jobs
for [n] arguments if you specify &*.
So, this command:
mpsh$ command one two three four &2
will execute two seperate processes:
command one three command two four
Execute a separate process per jpg file:
mpsh$ gen-thumbnails *.jpg &*
Execute a separate process per file, and submit each to a batch queue:
mpsh$ gen-thumbnails *.jpg &q*
In the "symmetric" form &n!, you can generate parallel instances regardless of the argument list, with the entire argument list duplicated for each process:
mpsh$ command one two three four &2!
will execute two processes, each with the full arguments:
command one two three four command one two three four
(&*! will still determine the number of instances to execute based on the argument list, but each instance will get all of the arguments.)
When executing multiprocess jobs, the "jobs" command can show how many processes the job was split into, and how many are still running. Also, job PID substitution ("kill -9 %gen") will include the PIDs for all processes that are still running.
If you want to use a multiprocess job in a pipeline, you have to use command grouping:
mpsh$ command | [ command arg &n ] | command