From cf8f1d924bb38d7faa79ed7773fee545cd8d0fe6 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 25 Nov 2012 21:24:27 +0100 Subject: [PATCH] parallel.pod: man page for --shebang-wrap. --- src/parallel | 3 +- src/parallel.pod | 65 ++++++++++++++++++++++++++++--------- src/parallel.texi | 82 ++++++++++++++++++++++++++++++++++++----------- 3 files changed, 115 insertions(+), 35 deletions(-) diff --git a/src/parallel b/src/parallel index dfdda5f5..a6398e5d 100755 --- a/src/parallel +++ b/src/parallel @@ -924,7 +924,7 @@ sub read_options { # @ARGV without --options # This must be done first as this may exec myself if(defined $ARGV[0] and ($ARGV[0]=~/^--shebang / or - $ARGV[0]=~/^--shebang-wrap / or + $ARGV[0]=~/^--shebang-?wrap / or $ARGV[0]=~/^--hashbang /)) { # Program is called from #! line in script # remove --shebang-wrap if it is set @@ -3553,6 +3553,7 @@ sub sshlogin_wrap { if($opt::workdir) { $self->{'sshlogin_wrap'} = ($pre . "$sshcmd $serverlogin $parallel_env " + . ::shell_quote_scalar("mkdir -p ".$self->workdir()."; ") . ::shell_quote_scalar("cd ".$self->workdir()." && ") . ::shell_quote_scalar($next_command_line).";".$post); } else { diff --git a/src/parallel.pod b/src/parallel.pod index c339eaf7..3b6ee64c 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -1159,6 +1159,55 @@ Use the replacement string I instead of B<{#}> for job sequence number. +=item B<--shebang> + +=item B<--hashbang> + +GNU B can be called as a shebang (#!) command as the first +line of a script. The content of the file will be treated as +inputsource. + +Like this: + + #!/usr/bin/parallel --shebang -r traceroute + + foss.org.my + debian.org + freenetproject.org + +B<--shebang> must be set as the first option. + + +=item B<--shebang-wrap> (alpha testing) + +GNU B can parallelize scripts by wrapping the shebang +line. If the program can be run like this: + + cat arguments | parallel the_program + +then the script can be changed to: + + #!/usr/bin/parallel --shebang-wrap /the/original/parser --with-options + +E.g. + + #!/usr/bin/parallel --shebang-wrap /usr/bin/python + +If the program can be run like this: + + cat data | parallel --pipe the_program + +then the script can be changed to: + + #!/usr/bin/parallel --shebang-wrap --pipe /the/original/parser --with-options + +E.g. + + #!/usr/bin/parallel --shebang-wrap --pipe /usr/bin/perl -w + +B<--shebang-wrap> must be set as the first option. + + =item B<--shellquote> Does not run the command but quotes it. Useful for making quoted @@ -1512,22 +1561,6 @@ Compare these two: See also B<--header>. - -=item B<--shebang> - -=item B<--hashbang> - -GNU B can be called as a shebang (#!) command as the first line of a script. Like this: - - #!/usr/bin/parallel --shebang -r traceroute - - foss.org.my - debian.org - freenetproject.org - -For this to work B<--shebang> must be set as the first option. - - =back diff --git a/src/parallel.texi b/src/parallel.texi index 9a831fe9..ee51a114 100644 --- a/src/parallel.texi +++ b/src/parallel.texi @@ -1241,6 +1241,70 @@ See also: @strong{man sem} Use the replacement string @emph{replace-str} instead of @strong{@{#@}} for job sequence number. +@item @strong{--shebang} +@anchor{@strong{--shebang}} + +@item @strong{--hashbang} +@anchor{@strong{--hashbang}} + +GNU @strong{Parallel} can be called as a shebang (#!) command as the first +line of a script. The content of the file will be treated as +inputsource. + +Like this: + +@verbatim + #!/usr/bin/parallel --shebang -r traceroute + + foss.org.my + debian.org + freenetproject.org +@end verbatim + +@strong{--shebang} must be set as the first option. + +@item @strong{--shebang-wrap} +@anchor{@strong{--shebang-wrap}} + +GNU @strong{Parallel} can parallelize scripts by wrapping the shebang +line. If the program can be run like this: + +@verbatim + cat arguments | parallel the_program +@end verbatim + +then the script can be changed to: + +@verbatim + #!/usr/bin/parallel --shebang-wrap /the/original/parser --with-options +@end verbatim + +E.g. + +@verbatim + #!/usr/bin/parallel --shebang-wrap /usr/bin/python +@end verbatim + +If the program can be run like this: + +@verbatim + cat data | parallel --pipe the_program +@end verbatim + +then the script can be changed to: + +@verbatim + #!/usr/bin/parallel --shebang-wrap --pipe /the/original/parser --with-options +@end verbatim + +E.g. + +@verbatim + #!/usr/bin/parallel --shebang-wrap --pipe /usr/bin/perl -w +@end verbatim + +@strong{--shebang-wrap} must be set as the first option. + @item @strong{--shellquote} @anchor{@strong{--shellquote}} @@ -1617,24 +1681,6 @@ Compare these two: See also @strong{--header}. -@item @strong{--shebang} -@anchor{@strong{--shebang}} - -@item @strong{--hashbang} -@anchor{@strong{--hashbang}} - -GNU @strong{Parallel} can be called as a shebang (#!) command as the first line of a script. Like this: - -@verbatim - #!/usr/bin/parallel --shebang -r traceroute - - foss.org.my - debian.org - freenetproject.org -@end verbatim - -For this to work @strong{--shebang} must be set as the first option. - @end table @chapter EXAMPLE: Working as xargs -n1. Argument appending