3 # SPDX-FileCopyrightText: 2021 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
5 # SPDX-License-Identifier: GPL-3.0-or-later
8 echo '### Test --env - https://savannah.gnu.org/bugs/?37351'
9 export TWOSPACES
=' 2 spaces '
10 export THREESPACES
=" > My brother's 12\" records < "
12 stdout parallel
--env TWOSPACES
echo 'a"$TWOSPACES"b' ::: 1
13 stdout parallel
-S localhost
--env TWOSPACES
echo 'a"$TWOSPACES"b' ::: 1
14 stdout parallel
-S csh@localhost
--env TWOSPACES
echo 'a"$TWOSPACES"b' ::: 1
15 stdout parallel
-S tcsh@localhost
--env TWOSPACES
echo 'a"$TWOSPACES"b' ::: 1
17 echo a
"$TWOSPACES"b a
"$THREESPACES"b
2
18 stdout parallel
--env TWOSPACES
--env THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
19 stdout parallel
-S localhost
--env TWOSPACES
--env THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
20 stdout parallel
-S csh@localhost
--env TWOSPACES
--env THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
21 stdout parallel
-S tcsh@localhost
--env TWOSPACES
--env THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
23 echo a
"$TWOSPACES"b a
"$THREESPACES"b
3
24 stdout parallel
--env TWOSPACES
,THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
25 stdout parallel
-S localhost
--env TWOSPACES
,THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
26 stdout parallel
-S csh@localhost
--env TWOSPACES
,THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
27 stdout parallel
-S tcsh@localhost
--env TWOSPACES
,THREESPACES
echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
33 stdout parallel
--env MIN
echo 'a"$MIN"b' ::: 4
34 stdout parallel
-S localhost
--env MIN
echo 'a"$MIN"b' ::: 4
35 stdout parallel
-S csh@localhost
--env MIN
echo 'a"$MIN"b' ::: 4
36 stdout parallel
-S tcsh@localhost
--env MIN
echo 'a"$MIN"b' ::: 4
40 export SPC
="'"' * ? >o <i*? ][\!#ยค%=( ) | }'
42 LANG
=C stdout parallel
--env SPC
echo 'a"$SPC"b' ::: 5
43 LANG
=C stdout parallel
-S localhost
--env SPC
echo 'a"$SPC"b' ::: 5
44 # \ misses due to quoting incompatiblilty between bash and csh
45 LANG
=C stdout parallel
-S csh@localhost
--env SPC
echo 'a"$SPC"b' ::: 5
46 LANG
=C stdout parallel
-S tcsh@localhost
--env SPC
echo 'a"$SPC"b' ::: 5
49 test_chr_on_sshlogin
() {
50 # test_chr_on_sshlogin 10,92 2/:,2/lo
51 # test_chr_on_sshlogin 10,92 2/tcsh@lo,2/csh@lo
55 perl
-e 'for('$chr') { printf "%c%c %c%d\0",$_,$_,$_,$_ }' |
56 stdout parallel
-j4 -k -I // --arg-sep _
-0 V
=// V2
=V2
=// LANG
=C parallel
-k -j1 $onall -S $sshlogin --env V
,V2
,LANG
echo \''"{}$V$V2"'\' ::: {#} {#} {#} {#} |
63 export -f test_chr_on_sshlogin
65 par_env_newline_backslash_bash
() {
66 echo '### Test --env for \n and \\ - single and double (bash only) - no output is good'
67 test_chr_on_sshlogin
10,92 2/:,2/lo
''
70 par_env_newline_backslash_csh
() {
71 echo '### Test --env for \n and \\ - single and double (*csh only) - no output is good but csh fails'
72 test_chr_on_sshlogin
10,92 2/tcsh@lo
,2/csh@lo
'' |
73 perl
-pe "s/'(.)'/\$1/g"
76 par_env_newline_backslash_onall_bash
() {
77 echo '### Test --env for \n and \\ - single and double --onall (bash only) - no output is good'
78 test_chr_on_sshlogin
10,92 :,lo
--onall |
79 grep -v "Unmatched '\"'"
82 par_env_newline_backslash_onall_csh
() {
83 echo '### Test --env for \n and \\ - single and double --onall (*csh only) - no output is good but csh fails'
84 test_chr_on_sshlogin
10,92 2/tcsh@lo
,2/csh@lo
--onall
88 echo '### Test --env for \160 - which kills csh - single and double - no output is good'
89 test_chr_on_sshlogin
160 :,1/lo
,1/tcsh@lo |
94 echo '### Test --env for \160 - which kills csh - single and double --onall - no output is good'
95 test_chr_on_sshlogin
160 :,1/lo
,1/tcsh@lo
--onall |
99 export -f $
(compgen
-A function |
grep par_
)
100 #compgen -A function | grep par_ | sort | parallel --delay $D -j$P --tag -k '{} 2>&1'
101 compgen
-A function |
grep par_ |
sort |
102 parallel
--joblog /tmp
/jl-
`basename $0` --retries 3 -j2 --tag -k '{} 2>&1'