diff --git a/src/parallel b/src/parallel index a52195f7..1ff5f773 100755 --- a/src/parallel +++ b/src/parallel @@ -735,8 +735,8 @@ sub parse_options { %Global::replace = ( '{}' => '', - '{#}' => '$_=$job->seq()', - '{%}' => '$_=$job->slot()', + '{#}' => '1 $_=$job->seq()', + '{%}' => '1 $_=$job->slot()', '{/}' => 's:.*/::', '{//}' => '$Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);', '{/.}' => 's:.*/::; s:\.[^/.]+$::;', diff --git a/src/parallel.pod b/src/parallel.pod index 9c2dbc7a..957996e4 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -1375,8 +1375,8 @@ it possible to define your own replacement strings. GNU B's 7 replacement strings are implemented as: --rpl '{} ' - --rpl '{#} $_=$job->seq()' - --rpl '{%} $_=$job->slot()' + --rpl '{#} 1 $_=$job->seq()' + --rpl '{%} 1 $_=$job->slot()' --rpl '{/} s:.*/::' --rpl '{//} $Global::use{"File::Basename"} ||= eval "use File::Basename; 1;"; $_ = dirname($_);' --rpl '{/.} s:.*/::; s:\.[^/.]+$::;' diff --git a/src/parallel_tutorial.1 b/src/parallel_tutorial.1 index e27c0811..63ff1081 100644 --- a/src/parallel_tutorial.1 +++ b/src/parallel_tutorial.1 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .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 .\" way too many mistakes in technical documents. .if n .ad l diff --git a/testsuite/tests-to-run/parallel-local-0.3s.sh b/testsuite/tests-to-run/parallel-local-0.3s.sh index 9976d7c1..3b9a1ec1 100644 --- a/testsuite/tests-to-run/parallel-local-0.3s.sh +++ b/testsuite/tests-to-run/parallel-local-0.3s.sh @@ -16,4 +16,10 @@ echo '### Test exit val - false'; echo '**' +echo '### Test bug #43284: {%} and {#} with --xapply'; + parallel --xapply 'echo {1} {#} {%} {2}' ::: a ::: b; + parallel -N2 'echo {%}' ::: a b + +echo '**' + EOF diff --git a/testsuite/wanted-results/parallel-local-0.3s b/testsuite/wanted-results/parallel-local-0.3s index f4f63571..22a6cab4 100644 --- a/testsuite/wanted-results/parallel-local-0.3s +++ b/testsuite/wanted-results/parallel-local-0.3s @@ -8,3 +8,9 @@ echo '### Test exit val - false'; echo false | parallel; echo $? 1 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 '**' +**