mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
parallel: quoting of replacement string.
This commit is contained in:
parent
ed45661bf7
commit
4e9170978a
|
@ -1481,7 +1481,7 @@ sub shell_quote {
|
|||
# @shell_quoted_strings = string quoted with \ as needed by the shell
|
||||
my @strings = (@_);
|
||||
for my $a (@strings) {
|
||||
$a =~ s/([\002-\011\013-\032\\\#\?\`\(\)\{\}\[\]\*\>\<\~\|\; \"\!\$\&\'\202-\377])/\\$1/g;
|
||||
$a =~ s/([\002-\011\013-\032\\\#\?\`\(\)\{\}\[\]\^\*\>\<\~\|\; \"\!\$\&\'\202-\377])/\\$1/g;
|
||||
$a =~ s/[\n]/'\n'/g; # filenames with '\n' is quoted using \'
|
||||
}
|
||||
return wantarray ? @strings : "@strings";
|
||||
|
@ -7210,6 +7210,8 @@ sub replaced {
|
|||
my $regexp = join('|', map { my $s = $_; $s =~ s/(\W)/\\$1/g; $s }
|
||||
sort { length $b <=> length $a } keys %replace);
|
||||
for(@target) {
|
||||
# ::debug("replace","Replace in ",::my_dump($_));
|
||||
# TODO can this be /o ?
|
||||
s/($regexp)/join(" ",@{$replace{$1}})/ge;
|
||||
}
|
||||
}
|
||||
|
@ -7287,8 +7289,9 @@ sub new {
|
|||
# Add {} if no replacement strings in @command
|
||||
($replacecount_ref, $len_ref, @command) =
|
||||
replacement_counts_and_lengths(@command);
|
||||
if("@command" =~ /^\S*\257</) {
|
||||
# Replacement string is (part of) the command (and not just argument)
|
||||
if("@command" =~ /^[^ \t\n=]*\257</) {
|
||||
# Replacement string is (part of) the command (and not just
|
||||
# argument or variable definition V1={})
|
||||
# E.g. parallel {}, parallel my_{= s/_//=}, parallel {2}
|
||||
# Do no quote (Otherwise it will fail if the input contains spaces)
|
||||
$Global::noquote = 1;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
### Test stdin goes to first command only ("-" as argument)
|
||||
Academic tradition requires you to cite works you base your article on.
|
||||
When using programs that use GNU Parallel to process data for publication please cite:
|
||||
|
||||
O. Tange (2011): GNU Parallel - The Command-Line Power Tool,
|
||||
;login: The USENIX Magazine, February 2011:42-47.
|
||||
|
||||
This helps funding further development; and it won't cost you a cent.
|
||||
Or you can get GNU Parallel without this requirement by paying 10000 EUR.
|
||||
If you pay 10000 EUR you should feel free to use GNU Parallel without citing.
|
||||
|
||||
To silence this citation notice run 'parallel --bibtex' once or use '--no-notice'.
|
||||
|
||||
|
@ -14,13 +15,14 @@ via first cat
|
|||
cat -
|
||||
via pseudotty
|
||||
### Test stdin goes to first command only ("cat" as argument)
|
||||
Academic tradition requires you to cite works you base your article on.
|
||||
When using programs that use GNU Parallel to process data for publication please cite:
|
||||
|
||||
O. Tange (2011): GNU Parallel - The Command-Line Power Tool,
|
||||
;login: The USENIX Magazine, February 2011:42-47.
|
||||
|
||||
This helps funding further development; and it won't cost you a cent.
|
||||
Or you can get GNU Parallel without this requirement by paying 10000 EUR.
|
||||
If you pay 10000 EUR you should feel free to use GNU Parallel without citing.
|
||||
|
||||
To silence this citation notice run 'parallel --bibtex' once or use '--no-notice'.
|
||||
|
||||
|
|
Loading…
Reference in a new issue