Fixed bug #43284: {%} and {#} with --xapply.

This commit is contained in:
Ole Tange 2014-09-23 20:14:57 +02:00
parent 9270b1284b
commit dee7e98321
5 changed files with 17 additions and 5 deletions

View file

@ -735,8 +735,8 @@ sub parse_options {
%Global::replace = %Global::replace =
( (
'{}' => '', '{}' => '',
'{#}' => '$_=$job->seq()', '{#}' => '1 $_=$job->seq()',
'{%}' => '$_=$job->slot()', '{%}' => '1 $_=$job->slot()',
'{/}' => 's:.*/::', '{/}' => 's:.*/::',
'{//}' => '$Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);', '{//}' => '$Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);',
'{/.}' => 's:.*/::; s:\.[^/.]+$::;', '{/.}' => 's:.*/::; s:\.[^/.]+$::;',

View file

@ -1375,8 +1375,8 @@ it possible to define your own replacement strings. GNU B<parallel>'s
7 replacement strings are implemented as: 7 replacement strings are implemented as:
--rpl '{} ' --rpl '{} '
--rpl '{#} $_=$job->seq()' --rpl '{#} 1 $_=$job->seq()'
--rpl '{%} $_=$job->slot()' --rpl '{%} 1 $_=$job->slot()'
--rpl '{/} s:.*/::' --rpl '{/} s:.*/::'
--rpl '{//} $Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);' --rpl '{//} $Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);'
--rpl '{/.} s:.*/::; s:\.[^/.]+$::;' --rpl '{/.} s:.*/::; s:\.[^/.]+$::;'

View file

@ -133,7 +133,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PARALLEL_TUTORIAL 1" .IX Title "PARALLEL_TUTORIAL 1"
.TH PARALLEL_TUTORIAL 1 "2014-09-04" "20140827" "parallel" .TH PARALLEL_TUTORIAL 1 "2014-09-23" "20140922" "parallel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l

View file

@ -16,4 +16,10 @@ echo '### Test exit val - false';
echo '**' echo '**'
echo '### Test bug #43284: {%} and {#} with --xapply';
parallel --xapply 'echo {1} {#} {%} {2}' ::: a ::: b;
parallel -N2 'echo {%}' ::: a b
echo '**'
EOF EOF

View file

@ -8,3 +8,9 @@ echo '### Test exit val - false'; echo false | parallel; echo $?
1 1
echo '**' echo '**'
** **
echo '### Test bug #43284: {%} and {#} with --xapply'; parallel --xapply 'echo {1} {#} {%} {2}' ::: a ::: b; parallel -N2 'echo {%}' ::: a b
### Test bug #43284: {%} and {#} with --xapply
a 1 1 b
1
echo '**'
**