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