mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-24 06:57:55 +00:00
parallel: --plus {/#regexp/str} replace ^regexp with str.
parallel: --plus {/%regexp/str} replace regexp$ with str.
This commit is contained in:
parent
f1b4a279a5
commit
5535b7cbeb
|
@ -2654,7 +2654,7 @@ sub check_invalid_option_combinations() {
|
|||
|
||||
sub init_globals() {
|
||||
# Defaults:
|
||||
$Global::version = 20220530;
|
||||
$Global::version = 20220605;
|
||||
$Global::progname = 'parallel';
|
||||
$::name = "GNU Parallel";
|
||||
$Global::infinity = 2**31;
|
||||
|
@ -2731,7 +2731,11 @@ sub init_globals() {
|
|||
# Bash ${a%%def}
|
||||
'{%%([^}]+?)}' => 's/$$1$//;',
|
||||
# Bash ${a/def/ghi} ${a/def/}
|
||||
'{/([^}/]+?)/([^}]*?)}' => 's/$$1/$$2/;',
|
||||
'{/([^#%}/]+?)/([^}]*?)}' => 's/$$1/$$2/;',
|
||||
# Bash ${a/#def/ghi} ${a/#def/}
|
||||
'{/#([^}]+?)/([^}]*?)}' => 's/^$$1/$$2/g;',
|
||||
# Bash ${a/%def/ghi} ${a/%def/}
|
||||
'{/%([^}]+?)/([^}]*?)}' => 's/$$1$/$$2/g;',
|
||||
# Bash ${a//def/ghi} ${a//def/}
|
||||
'{//([^}]+?)/([^}]*?)}' => 's/$$1/$$2/g;',
|
||||
# Bash ${a^a}
|
||||
|
|
|
@ -516,6 +516,16 @@ par_plus_dyn_repl() {
|
|||
parallel --plus echo '{,,A}' ::: "$myvar"
|
||||
parallel --plus echo '{2,,A}' ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||
parallel --plus echo '{-2,,A}' ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||
|
||||
myvar=abcabcdefdef
|
||||
echo $myvar ${myvar/#abc/ABC}
|
||||
echo $myvar | parallel --plus echo {} {/#abc/ABC}
|
||||
echo $myvar ${myvar/%def/DEF}
|
||||
echo $myvar | parallel --plus echo {} {/%def/DEF}
|
||||
echo $myvar ${myvar/#abc/}
|
||||
echo $myvar | parallel --plus echo {} {/#abc/}
|
||||
echo $myvar ${myvar/%def/}
|
||||
echo $myvar | parallel --plus echo {} {/%def/}
|
||||
}
|
||||
|
||||
par_keeporder_roundrobin() {
|
||||
|
|
|
@ -1668,6 +1668,14 @@ par_plus_dyn_repl abcaaadef
|
|||
par_plus_dyn_repl abcaaadef
|
||||
par_plus_dyn_repl abcaaadef
|
||||
par_plus_dyn_repl abcaaadef
|
||||
par_plus_dyn_repl abcabcdefdef ABCabcdefdef
|
||||
par_plus_dyn_repl abcabcdefdef ABCabcdefdef
|
||||
par_plus_dyn_repl abcabcdefdef abcabcdefDEF
|
||||
par_plus_dyn_repl abcabcdefdef abcabcdefDEF
|
||||
par_plus_dyn_repl abcabcdefdef abcdefdef
|
||||
par_plus_dyn_repl abcabcdefdef abcdefdef
|
||||
par_plus_dyn_repl abcabcdefdef abcabcdef
|
||||
par_plus_dyn_repl abcabcdefdef abcabcdef
|
||||
par_race_condition1 ### Test race condition on 8 CPU (my laptop)
|
||||
par_race_condition1 1
|
||||
par_race_condition1 2
|
||||
|
|
Loading…
Reference in a new issue