[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Parallel Cons Issue
From: |
Jeff Rosenfeld |
Subject: |
RE: Parallel Cons Issue |
Date: |
Thu, 6 Sep 2001 16:57:24 -0700 |
It's valid, but not efficient. Parens cause the shell to execute the
enclosed command in a subshell. Mostly handy for obscure sorts of
redirections like:
(Command 2>&1 >/dev/null) | FilterErrors
or, for csh users:
(Command >/dev/null) |& FilterErrors
- Jeff.
-----Original Message-----
From: Rajesh Vaidheeswarran [mailto:address@hidden
Sent: Thursday, September 06, 2001 4:48 PM
To: Wayne Scott
Cc: address@hidden; address@hidden;
address@hidden
Subject: Re: Parallel Cons Issue
You may not need to test for max_jobs at all, since ( cmd ) is valid
even for a single command.
So, that could become
my @cmds = join " && ", map "( $_ )", $self->getcoms($env, $tgt); #
pcons
the simple test being..
% perl -e '@cmds = qw(a b c d e); print join " && ", map "( $_ )",
@cmds'
( a ) && ( b ) && ( c ) && ( d ) && ( e )
% perl -e '@cmds = qw(e); print join " && ", map "( $_ )", @cmds'
( e )
In a previous message, Wayne Scott writes:
> From: "Nolish, Kevin" <address@hidden>
> > my @cmds = $self->getcoms($env, $tgt); # pcons
> > if ($param::max_jobs>1) { # pcons
> > for( $i = 0; $i < @cmds; $i++ ) { #pcons -kn
> > $cmds[$i] = "( " . $cmds[$i] . " )"; #pcons -kn
> > } #pcons -kn
> > @cmds = join(" && ", @cmds) ; # pcons
> > }
>
>
> This is cleaner.... but untested.
>
> my @cmds = $self->getcoms($env, $tgt); # pcons
> if ($param::max_jobs>1) { # pcons
> @cmds = (join(" && ", map {"( $_ )"} @cmds)) ; # pcons
> }
>
> -Wayne
>
> _______________________________________________
> address@hidden
> http://mail.gnu.org/mailman/listinfo/cons-discuss
> Cons URL: http://www.dsmit.com/cons/
_______________________________________________
address@hidden
http://mail.gnu.org/mailman/listinfo/cons-discuss
Cons URL: http://www.dsmit.com/cons/