Re: [Help-bash] parallel processing in bash (to replace for loop)
From:
Greg Wooledge
Subject:
Re: [Help-bash] parallel processing in bash (to replace for loop)
Date:
Thu, 10 May 2012 08:13:13 -0400
User-agent:
Mutt/1.4.2.3i
On Wed, May 09, 2012 at 11:12:38PM +0200, Ole Tange wrote:
> From GNU Parallel's man page:
>
> _command_ Command to execute.
> [...]
> The command must be an executable, a script, a composed command,
> or a function. If it is a function you need to export -f the
> function first. An alias will, however, not work (see why
>http://www.perlmonks.org/index.pl?node_id=484296).
>
> So it is not entirely true that GNU Parallel is not able to understand
> bash functions, but it _is_ true, that it does not work without the
> export.
More precisely, parallel invokes bash, and bash can extract the function
definition from the environment. Parallel doesn't understand the function
definition embedded in the environment, but it doesn't need to; it simply
passes the environment along untouched.
Of course this won't work if parallel invokes sh instead of bash.