Lines Matching +full:setup +full:- +full:test +full:- +full:env

2 # -*- mode: sh -*-
3 #-
23 #-
24 # You may also want to test IFS with the script at
28 # http://svnweb.freebsd.org/base/head/bin/test/tests/legacy_test.sh?view=co&content-type=text%2Fpla…
31 # (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
33 expected-stdout:
41 ---
42 expected-stdout:
48 name: KSH_VERSION-modern
49 category: !shell:legacy-yes
50 ---
51 expected-stdout:
57 name: KSH_VERSION-legacy
58 category: !shell:legacy-no
59 ---
60 name: KSH_VERSION-ascii
63 category: !shell:ebcdic-yes
65 set -o noglob
70 ---
71 name: KSH_VERSION-ebcdic
74 category: !shell:ebcdic-no
76 set -o noglob
81 ---
82 name: KSH_VERSION-binmode
85 category: !shell:textmode-yes
87 set -o noglob
92 ---
93 name: KSH_VERSION-textmode
96 category: !shell:textmode-no
98 set -o noglob
103 ---
104 name: selftest-1
106 Regression test self-testing
108 echo ${foo:-baz}
109 expected-stdout:
111 ---
112 name: selftest-2
114 Regression test self-testing
115 env-setup: !foo=bar!
117 echo ${foo:-baz}
118 expected-stdout:
120 ---
121 name: selftest-3
123 Regression test self-testing
124 env-setup: !ENV=fnord!
126 echo "<$ENV>"
127 expected-stdout:
129 ---
130 name: selftest-exec
132 Ensure that the test run directory (default /tmp but can be changed
133 with check.pl flag -T or test.sh $TMPDIR) is not mounted noexec, as
139 expected-stdout:
141 ---
142 name: selftest-env
148 ---
149 name: selftest-direct-builtin-call
153 ln -s "$__progname" cat || cp "$__progname" cat
154 ln -s "$__progname" echo || cp "$__progname" echo
155 ./echo -c 'echo foo' | ./cat -u
156 expected-stdout:
157 -c echo foo
158 ---
159 name: selftest-pathsep-unix
165 "$__progname" -c 'print -r -- $PATHSEP'
166 expected-stdout:
168 ---
169 name: selftest-pathsep-dospath
175 "$__progname" -c 'print -r -- $PATHSEP'
176 expected-stdout:
178 ---
179 name: selftest-tty-absent
181 Check that a controlling tty is not present as regress:no-ctty was used
182 (if this test fails for you DO NOT PASS regress:no-ctty and fix every
183 other test that fails: why u use it if u haz ctty?)
184 category: regress:no-ctty
185 env-setup: !ENV=./envf!
186 file-setup: file 644 "envf"
188 arguments: !-i!
191 expected-stdout:
193 expected-stderr-pattern:
195 ---
196 name: selftest-tty-present
198 Check that a controlling tty is present as regress:no-ctty was not used
199 need-ctty: yes
200 env-setup: !ENV=./envf!
201 file-setup: file 644 "envf"
203 arguments: !-i!
206 expected-stdout:
208 expected-stderr: !
210 ---
211 name: alias-1
218 expected-stderr-pattern:
220 ---
221 name: alias-2
230 expected-stderr-pattern:
232 ---
233 name: alias-3
243 expected-stdout:
246 ---
247 name: alias-4
256 expected-stdout:
258 ---
259 name: alias-5
269 expected-stdout:
271 ---
272 name: alias-6
281 expected-stdout:
283 ---
284 name: alias-7
292 expected-stdout:
294 ---
295 name: alias-8
311 expected-stdout:
314 ---
315 name: alias-9
319 the time-limit clause (e.g. to 7) if this occurs.
320 time-limit: 3
329 print -r -- $i
332 expected-stdout:
337 ---
338 name: alias-10
346 expected-stdout:
348 ---
349 name: alias-11
357 print -r -- "$x,$y"
361 print -r -- "$x,$y"
363 x=1 y=2; fooa 'bar - baz'
364 x=1 y=2; foob 'bar - baz'
365 expected-stdout:
366 bar - baz,z
367 bar - baz,z
368 ---
369 name: alias-12
375 typeset -f x
380 expected-stdout:
389 ---
390 name: arith-compound
395 expected-stderr:
397 ---
398 name: arith-lazy-1
404 typeset -i i=1 j=1
409 expected-stdout:
414 ---
415 name: arith-lazy-2
417 Check that assignments not done on non-evaluated side of ternary
422 typeset -i i=1 j=1
427 expected-stdout:
432 ---
433 name: arith-lazy-3
435 Check that assignments not done on non-evaluated side of ternary
441 expected-stdout:
443 ---
444 name: arith-lazy-4
446 Check that preun/postun not done on non-evaluated side of ternary
453 expected-stdout:
459 ---
460 name: arith-lazy-5-arr-n
464 expected-stdout:
466 ---
467 name: arith-lazy-5-arr-p
471 expected-stdout:
473 ---
474 name: arith-lazy-5-str-n
478 expected-stdout:
480 ---
481 name: arith-lazy-5-str-p
485 expected-stdout:
487 ---
488 name: arith-lazy-5-tern-l-n
492 expected-stdout:
494 ---
495 name: arith-lazy-5-tern-l-p
499 expected-stdout:
501 ---
502 name: arith-lazy-5-tern-r-n
506 expected-stdout:
508 ---
509 name: arith-lazy-5-tern-r-p
513 expected-stdout:
515 ---
516 name: arith-ternary-prec-1
520 typeset -i x=2
522 expected-exit: e != 0
523 expected-stderr-pattern:
525 ---
526 name: arith-ternary-prec-2
530 typeset -i x=2
532 expected-stdout:
534 ---
535 name: arith-prec-1
543 expected-stdout:
546 ---
547 name: arith-div-assoc-1
552 expected-stdout:
554 ---
555 name: arith-div-byzero
561 expected-stdout:
563 expected-stderr-pattern:
565 ---
566 name: arith-div-intmin-by-minusone
571 echo signed:$((-2147483648 / -1))r$((-2147483648 % -1)).
572 echo unsigned:$((# -2147483648 / -1))r$((# -2147483648 % -1)).
573 expected-stdout:
574 signed:-2147483648r0.
576 ---
577 name: arith-div-intmin-by-minusone-64
582 echo signed:$((-9223372036854775808 / -1))r$((-9223372036854775808 % -1)).
583 echo unsigned:$((# -9223372036854775808 / -1))r$((# -9223372036854775808 % -1)).
584 expected-stdout:
585 signed:-9223372036854775808r0.
587 ---
588 name: arith-assop-assoc-1
590 Check associativity of assignment-operator operator
592 typeset -i i=1 j=2 k=3
595 expected-stdout:
598 ---
599 name: arith-mandatory
601 Passing of this test is *mandatory* for a valid mksh executable!
602 category: shell:legacy-no
604 typeset -i sari=0
605 typeset -Ui uari=0
606 typeset -i x=0
607 print -r -- $((x++)):$sari=$uari. #0
608 let --sari --uari
609 print -r -- $((x++)):$sari=$uari. #1
611 print -r -- $((x++)):$sari=$uari. #2
613 print -r -- $((x++)):$sari=$uari. #3
614 let --sari --uari
617 print -r -- $((x++)):$sari=$uari. #4
619 print -r -- $((x++)):$sari=$uari. #5
620 sari=-2147483648 uari=-2147483648
621 print -r -- $((x++)):$sari=$uari. #6
622 let --sari --uari
623 print -r -- $((x++)):$sari=$uari. #7
624 (( sari = -5 >> 1 ))
625 ((# uari = -5 >> 1 ))
626 print -r -- $((x++)):$sari=$uari. #8
627 (( sari = -2 ))
629 print -r -- $((x++)):$sari=$uari. #9
630 expected-stdout:
632 1:-1=4294967295.
634 3:-2147483648=2147483648.
635 4:-1=4294967295.
637 6:-2147483648=2147483648.
639 8:-3=2147483645.
640 9:-2=4294967294.
641 ---
642 name: arith-unsigned-1
648 echo x1 $((-1)) $((#-1))
650 typeset -i vs
651 typeset -Ui vu
667 set -A va
672 let '# mca = -4 % -2' ' mcb = -4 % -2'
674 expected-stdout:
675 x1 -1 4294967295
676 x2 -171510507 4123456789
677 x3 -171510507 4123456789
679 x5 -171510507 4123456789
682 x8 -4 0
683 ---
684 name: arith-limit32-1
690 echo x1 $((-1)) $((#-1))
692 typeset -i vs
693 typeset -Ui vu
704 expected-stdout:
705 x1 -1 4294967295
707 x3 -2147483648 2147483648
708 x4 -1 4294967295
711 ---
712 name: arith-limit64-1
718 echo x1 $((-1)) $((#-1))
720 typeset -i vs
721 typeset -Ui vu
732 expected-stdout:
733 x1 -1 18446744073709551615
735 x3 -9223372036854775808 9223372036854775808
736 x4 -1 18446744073709551615
739 ---
740 name: bksl-nl-ign-1
746 expected-stdout:
749 ---
750 name: bksl-nl-ign-2
757 expected-stdout:
761 ---
762 name: bksl-nl-ign-3
770 expected-stdout:
773 ---
774 name: bksl-nl-ign-4
776 Check interaction of aliases, single quotes and here-documents
777 with backslash-newline
790 expected-stdout:
797 ---
798 name: bksl-nl-ign-5
805 expected-stdout:
808 ---
812 name: bksl-nl-1
821 expected-stdout:
823 ---
824 name: bksl-nl-2
841 expected-stdout:
847 ---
848 name: bksl-nl-3
865 expected-stdout:
872 ---
873 name: bksl-nl-4
888 expected-stdout:
894 ---
895 name: bksl-nl-5
905 expected-stdout:
909 ---
910 name: bksl-nl-6
927 expected-stdout:
932 ---
933 name: bksl-nl-7
935 Check that \newline is collapsed in double-quoted here-document
946 expected-stdout:
951 ---
952 name: bksl-nl-8
968 - EOF
987 expected-stdout:
996 ---
997 name: bksl-nl-9
1006 expected-stdout:
1008 ---
1009 name: bksl-nl-10
1017 expected-stdout:
1019 ---
1023 name: bksl-nl-ksh-1
1037 expected-stdout:
1039 ---
1040 name: bksl-nl-ksh-2
1052 expected-stdout:
1054 ---
1055 name: break-1
1059 for i in a b c; do echo $i; break; echo bad-$i; done
1060 echo end-1
1061 for i in a b c; do echo $i; break 1; echo bad-$i; done
1062 echo end-2
1067 echo bad-$i
1069 echo end-$i
1071 echo end-3
1072 for i in a b c; do echo $i; eval break; echo bad-$i; done
1073 echo end-4
1074 expected-stdout:
1076 end-1
1078 end-2
1080 end-a
1082 end-b
1084 end-c
1085 end-3
1087 end-4
1088 ---
1089 name: break-2
1097 echo bad-$i
1099 echo end-$i
1102 expected-stdout:
1105 ---
1106 name: break-3
1112 expected-stderr-pattern:
1114 ---
1115 name: break-4
1117 What if break N used when only N-1 loops
1120 for i in a b c; do echo $i; break 2; echo bad-$i; done
1122 expected-stdout:
1125 expected-stderr-pattern:
1127 ---
1128 name: break-5
1132 for i in a b c; do echo $i; break abc; echo more-$i; done
1134 expected-stdout:
1136 expected-exit: e != 0
1137 expected-stderr-pattern:
1139 ---
1140 name: continue-1
1144 for i in a b c; do echo $i; continue; echo bad-$i ; done
1145 echo end-1
1146 for i in a b c; do echo $i; continue 1; echo bad-$i; done
1147 echo end-2
1152 echo bad-$i-$j
1154 echo end-$i
1156 echo end-3
1157 for i in a b c; do echo $i; eval continue; echo bad-$i ; done
1158 echo end-4
1159 expected-stdout:
1163 end-1
1167 end-2
1171 end-a
1175 end-b
1179 end-c
1180 end-3
1184 end-4
1185 ---
1186 name: continue-2
1194 echo bad-$i-$j
1196 echo end-$i
1199 expected-stdout:
1204 ---
1205 name: continue-3
1211 expected-stderr-pattern:
1213 ---
1214 name: continue-4
1216 What if continue N used when only N-1 loops
1219 for i in a b c; do echo $i; continue 2; echo bad-$i; done
1221 expected-stdout:
1226 expected-stderr-pattern:
1228 ---
1229 name: continue-5
1233 for i in a b c; do echo $i; continue abc; echo more-$i; done
1235 expected-stdout:
1237 expected-exit: e != 0
1238 expected-stderr-pattern:
1240 ---
1241 name: cd-history
1243 Test someone's CD history package (uses arrays)
1251 typeset -i cdlen i
1254 if [ $# -eq 0 ]
1256 set -- $HOME
1259 if [ "$CDHISTFILE" -a -r "$CDHISTFILE" ] # if directory history exists
1262 i=-1
1263 while read -r t # read directory history file
1269 if [ "${CDHIST[0]}" != "$PWD" -a "$PWD" != "" ]
1277 -) # cd to new dir
1288 -l) # print directory list
1289 typeset -R3 num
1291 while (((i=i-1)>=0))
1298 -[0-9]|-[0-9][0-9]) # cd to dir in list
1299 if (((i=${1#-})<cdlen))
1309 -*) # cd to matched dir in list
1310 t=${1#-}
1345 'print' -r ${CDHIST[i]} # update directory history
1353 typeset -i i
1370 while (((i=i-1)>=0)) # bump old dirs in list
1381 if [ -n "$ECD" ]
1386 # Start of test
1390 cd -
1391 cd -2
1392 cd -l
1393 expected-stdout:
1400 ---
1401 name: cd-pe
1403 Check package for cd -Pe
1404 need-pass: no
1409 file-setup: file 644 "x"
1411 ln -s noread link
1413 cd -P$1 .
1416 cd -P$1 link/target
1418 epwd=$($TSHELL -c pwd 2>/dev/null)
1423 cd -P$1 subdir
1427 rm -rf noread link renamed
1431 echo "now with -e:"
1433 expected-stdout:
1437 now with -e:
1441 ---
1442 name: env-prompt
1444 Check that prompt not printed when processing ENV
1445 env-setup: !ENV=./foo!
1446 file-setup: file 644 "foo"
1450 need-ctty: yes
1451 arguments: !-i!
1454 expected-stdout:
1456 expected-stderr: !
1458 ---
1459 name: expand-ugly
1463 print '#!'"$__progname"'\nfor x in "$@"; do print -r -- "$x"; done' >pfn
1464 print '#!'"$__progname"'\nfor x in "$@"; do print -nr -- "<$x> "; done' >pfs
1469 (echo -n '4 '; ./pfn "foo ${IFS+"b c"} baz") 2>/dev/null || echo failed in 4
1470 (echo -n '5 '; ./pfn "foo ${IFS+b c} baz") 2>/dev/null || echo failed in 5
1480 …u=x; (echo -n '15 '; ./pfs "foo ${IFS+a"b$u{ {"{{\}b} c ${IFS+d{}} bar" ${IFS-e{}} baz; echo .) 2>…
1481 l=t; (echo 16 ${IFS+h`echo -n i ${IFS+$l}h`ere}) 2>/dev/null || echo failed in 16
1482 l=t; (echo 17 ${IFS+h$(echo -n i ${IFS+$l}h)ere}) 2>/dev/null || echo failed in 17
1483 l=t; (echo 18 "${IFS+h`echo -n i ${IFS+$l}h`ere}") 2>/dev/null || echo failed in 18
1484 l=t; (echo 19 "${IFS+h$(echo -n i ${IFS+$l}h)ere}") 2>/dev/null || echo failed in 19
1485 l=t; (echo 20 ${IFS+h`echo -n i "${IFS+$l}"h`ere}) 2>/dev/null || echo failed in 20
1486 l=t; (echo 21 ${IFS+h$(echo -n i "${IFS+$l}"h)ere}) 2>/dev/null || echo failed in 21
1487 l=t; (echo 22 "${IFS+h`echo -n i "${IFS+$l}"h`ere}") 2>/dev/null || echo failed in 22
1488 l=t; (echo 23 "${IFS+h$(echo -n i "${IFS+$l}"h)ere}") 2>/dev/null || echo failed in 23
1489 key=value; (echo -n '24 '; ./pfn "${IFS+'$key'}") 2>/dev/null || echo failed in 24
1490 …key=value; (echo -n '25 '; ./pfn "${IFS+"'$key'"}") 2>/dev/null || echo failed in 25 # ksh93: “'$k…
1491 key=value; (echo -n '26 '; ./pfn ${IFS+'$key'}) 2>/dev/null || echo failed in 26
1492 key=value; (echo -n '27 '; ./pfn ${IFS+"'$key'"}) 2>/dev/null || echo failed in 27
1493 (echo -n '28 '; ./pfn "${IFS+"'"x ~ x'}'x"'}"x}" #') 2>/dev/null || echo failed in 28
1494 …u=x; (echo -n '29 '; ./pfs foo ${IFS+a"b$u{ {"{ {\}b} c ${IFS+d{}} bar ${IFS-e{}} baz; echo .) 2>/…
1495 (echo -n '30 '; ./pfs ${IFS+foo 'b\
1497 (echo -n '32 '; ./pfs ${IFS+foo "b\
1499 (echo -n '33 '; ./pfs "${IFS+foo 'b\
1501 (echo -n '34 '; ./pfs "${IFS+foo "b\
1503 (echo -n '35 '; ./pfs ${v=a\ b} x ${v=c\ d}; echo .) 2>/dev/null || echo failed in 35
1504 (echo -n '36 '; ./pfs "${v=a\ b}" x "${v=c\ d}"; echo .) 2>/dev/null || echo failed in 36
1505 (echo -n '37 '; ./pfs ${v-a\ b} x ${v-c\ d}; echo .) 2>/dev/null || echo failed in 37
1508 foo="a b c"; (echo -n '40 '; ./pfs "${foo#a}"; echo .) 2>/dev/null || echo failed in 40
1510 expected-stdout:
1552 ---
1553 name: expand-unglob-dblq
1560 test x"$v" = x"-" && unset v
1562 (echo "$1 dash norm foo ${v-'bar'} baz")
1565 echo "$1 qstn norm -> error"
1567 (echo "$1 DASH norm foo ${v:-'bar'} baz")
1570 echo "$1 QSTN norm -> error"
1574 test x"$v" = x"-" && unset v
1576 (echo "$1 dash parn foo ${v-(bar)} baz")
1579 echo "$1 qstn parn -> error"
1581 (echo "$1 DASH parn foo ${v:-(bar)} baz")
1584 echo "$1 QSTN parn -> error"
1588 test x"$v" = x"-" && unset v
1590 (echo "$1 dash brac foo ${v-a$u{{{\}b} c ${v-d{}} baz")
1593 echo "$1 qstn brac -> error"
1595 (echo "$1 DASH brac foo ${v:-a$u{{{\}b} c ${v:-d{}} baz")
1598 echo "$1 QSTN brac -> error"
1601 tl_norm 1 -
1604 tl_paren 4 -
1607 tl_brace 7 -
1610 expected-stdout:
1614 1 qstn norm -> error
1618 1 QSTN norm -> error
1626 2 QSTN norm -> error
1638 4 qstn parn -> error
1642 4 QSTN parn -> error
1650 5 QSTN parn -> error
1662 7 qstn brac -> error
1666 7 QSTN brac -> error
1674 8 QSTN brac -> error
1683 ---
1684 name: expand-unglob-unq
1691 test x"$v" = x"-" && unset v
1693 (echo $1 dash norm foo ${v-'bar'} baz)
1696 echo "$1 qstn norm -> error"
1698 (echo $1 DASH norm foo ${v:-'bar'} baz)
1701 echo "$1 QSTN norm -> error"
1705 test x"$v" = x"-" && unset v
1707 (echo $1 dash parn foo ${v-\(bar')'} baz)
1710 echo "$1 qstn parn -> error"
1712 (echo $1 DASH parn foo ${v:-\(bar')'} baz)
1715 echo "$1 QSTN parn -> error"
1719 test x"$v" = x"-" && unset v
1721 (echo $1 dash brac foo ${v-a$u{{{\}b} c ${v-d{}} baz)
1724 echo "$1 qstn brac -> error"
1726 (echo $1 DASH brac foo ${v:-a$u{{{\}b} c ${v:-d{}} baz)
1729 echo "$1 QSTN brac -> error"
1732 tl_norm 1 -
1735 tl_paren 4 -
1738 tl_brace 7 -
1741 expected-stdout:
1745 1 qstn norm -> error
1749 1 QSTN norm -> error
1757 2 QSTN norm -> error
1769 4 qstn parn -> error
1773 4 QSTN parn -> error
1781 5 QSTN parn -> error
1793 7 qstn brac -> error
1797 7 QSTN brac -> error
1805 8 QSTN brac -> error
1814 ---
1815 name: expand-threecolons-dblq
1819 TEST=1234
1820 echo "${TEST:1:2:3}"
1822 expected-stderr-pattern:
1824 expected-exit: 1
1825 ---
1826 name: expand-threecolons-unq
1830 TEST=1234
1831 echo ${TEST:1:2:3}
1833 expected-stderr-pattern:
1835 expected-exit: 1
1836 ---
1837 name: expand-weird-1
1851 expected-stdout:
1858 ---
1859 name: expand-weird-2
1863 :& set -C; pid=$$; sub=$!; flg=$-; set -- i; exec 3>x.tmp
1864 #echo "D: !=$! #=$# \$=$$ -=$- ?=$?"
1865 echo >&3 3 = s^${!-word} , ${#-word} , p^${$-word} , f^${--word} , ${?-word} .
1866 echo >&3 4 = ${!+word} , ${#+word} , ${$+word} , ${-+word} , ${?+word} .
1867 echo >&3 5 = s^${!=word} , ${#=word} , p^${$=word} , f^${-=word} , ${?=word} .
1868 echo >&3 6 = s^${!?word} , ${#?word} , p^${$?word} , f^${-?word} , ${??word} .
1869 echo >&3 7 = sl^${#!} , ${##} , pl^${#$} , fl^${#-} , ${#?} .
1870 echo >&3 8 = sw^${%!} , ${%#} , pw^${%$} , fw^${%-} , ${%?} .
1871 echo >&3 9 = ${!!} , s^${!#} , ${!$} , s^${!-} , s^${!?} .
1872 echo >&3 10 = s^${!#pattern} , ${##pattern} , p^${$#pattern} , f^${-#pattern} , ${?#pattern} .
1873 echo >&3 11 = s^${!%pattern} , ${#%pattern} , p^${$%pattern} , f^${-%pattern} , ${?%pattern} .
1875 set --
1877 set -- 1 2 3 4 5
1879 set -- 1 2 3 4 5 6 7 8 9 a b c d e
1881 exec 3>&-
1883 -e "s/ pl^${#pid} / PID /g" -e "s/ sl^${#sub} / SUB /g" -e "s/ fl^${#flg} / FLG /g" \
1884 -e "s/ pw^${%pid} / PID /g" -e "s/ sw^${%sub} / SUB /g" -e "s/ fw^${%flg} / FLG /g" \
1885 -e "s/ p^$pid / PID /g" -e "s/ s^$sub / SUB /g" -e "s/ f^$flg / FLG /g"
1886 expected-stdout:
1900 ---
1901 name: expand-weird-3
1905 A=9999-02
1908 set -- $A $B
1910 expected-stdout:
1913 ---
1914 name: expand-weird-4
1921 echo "<${a#~}> <${a#\~}> <${b:-~}> <${b:-\~}> <${c:=~}><$c> <${a/~}> <${a/x/~}> <${a/x/\~}>"
1922 expected-stdout:
1924 ---
1925 name: expand-bang-1
1930 expected-exit: 1
1931 expected-stderr-pattern: /not set/
1932 ---
1933 name: expand-bang-2
1939 echo 3 ${!#[0-9]} .
1940 echo 4 ${!-foo} .
1941 # get an at least three-digit bg pid
1945 if [[ $x != +([0-9]) ]]; then
1946 echo >&2 "cannot test, pid '$x' not numeric"
1950 [[ $x = [0-9][0-9][0-9]* ]] && break
1955 t=${!#[0-9]}; [[ $t = $y ]]; echo 7 $? .
1956 t=${!-foo}; [[ $t = $x ]]; echo 8 $? .
1958 expected-stdout:
1968 ---
1969 name: expand-number-1
1974 expected-stdout:
1976 ---
1977 name: expand-slashes-1
1986 expected-stdout:
1989 ---
1990 name: expand-slashes-2
1999 expected-stdout:
2002 ---
2003 name: expand-slashes-3
2009 expected-stdout:
2011 ---
2012 name: eglob-bad-1
2016 file-setup: file 644 "@(a[b|)c]foo"
2019 expected-stdout:
2021 ---
2022 name: eglob-bad-2
2025 (AT&T ksh fails this test)
2026 file-setup: file 644 "abcx"
2027 file-setup: file 644 "abcz"
2028 file-setup: file 644 "bbc"
2031 expected-stdout:
2033 ---
2034 name: eglob-infinite-plus
2038 file-setup: file 644 "abc"
2039 time-limit: 3
2045 expected-stdout:
2050 ---
2051 name: eglob-subst-1
2054 file-setup: file 644 "abc"
2058 expected-stdout:
2060 ---
2061 name: eglob-nomatch-1
2065 echo 1: no-file+(a|b)stuff
2066 echo 2: no-file+(a*(c)|b)stuff
2067 echo 3: no-file+((((c)))|b)stuff
2068 expected-stdout:
2069 1: no-file+(a|b)stuff
2070 2: no-file+(a*(c)|b)stuff
2071 3: no-file+((((c)))|b)stuff
2072 ---
2073 name: eglob-match-1
2076 file-setup: file 644 "abd"
2077 file-setup: file 644 "acd"
2078 file-setup: file 644 "abac"
2084 expected-stdout:
2089 ---
2090 name: eglob-case-1
2096 expected-stdout:
2099 ---
2100 name: eglob-case-2
2108 expected-stdout:
2113 ---
2114 name: eglob-trim-1
2117 (AT&T ksh fails this - docs say # matches shortest string, ## matches
2125 expected-stdout:
2130 ---
2131 name: eglob-trim-2
2140 expected-stdout:
2145 ---
2146 name: eglob-trim-3
2149 Ensure eglobbing does not work for reduced-feature /bin/sh
2157 set -o sh
2161 expected-stdout:
2166 ---
2167 name: eglob-substrpl-1
2171 [[ -n $BASH_VERSION ]] && shopt -s extglob
2205 expected-stdout:
2237 ---
2238 name: eglob-substrpl-2
2249 expected-stdout:
2256 ---
2257 name: eglob-substrpl-3a
2270 expected-stdout:
2277 ---
2278 name: eglob-substrpl-3b
2288 expected-stdout:
2292 ---
2293 name: eglob-substrpl-3c
2309 [[ -n $BASH_VERSION ]] && shopt -s extglob
2336 expected-stdout:
2371 ---
2372 name: eglob-utf8-1
2374 UTF-8 mode differences for eglobbing
2375 category: !shell:ebcdic-yes
2381 set -U
2394 expected-stdout:
2404 ---
2405 name: glob-bad-1
2408 but does not prevent globbing, while backslash-escaping does
2409 file-setup: dir 755 "[x"
2410 file-setup: file 644 "[x/foo"
2416 :>'a[a-z][x'
2417 echo a[a-z][*
2418 echo a[a-z]*
2419 echo a[a\-z]*
2420 expected-stdout:
2426 a[a-z]*
2427 ---
2428 name: glob-bad-2
2435 file-setup: dir 755 "dir"
2436 file-setup: symlink 644 "dir/abc"
2437 non-existent-file
2441 expected-stdout:
2444 ---
2445 name: glob-bad-3
2454 expected-stdout:
2456 ---
2457 name: glob-range-1
2459 Test range matching
2460 file-setup: file 644 ".bc"
2461 file-setup: file 644 "abc"
2462 file-setup: file 644 "bbc"
2463 file-setup: file 644 "cbc"
2464 file-setup: file 644 "-bc"
2465 file-setup: file 644 "!bc"
2466 file-setup: file 644 "^bc"
2467 file-setup: file 644 "+bc"
2468 file-setup: file 644 ",bc"
2469 file-setup: file 644 "0bc"
2470 file-setup: file 644 "1bc"
2472 echo [ab-]*
2473 echo [-ab]*
2474 echo [!-ab]*
2478 echo [+--]*
2479 echo [--1]*
2481 expected-stdout:
2482 -bc abc bbc
2483 -bc abc bbc
2485 !bc +bc ,bc -bc 0bc 1bc ^bc cbc
2488 +bc ,bc -bc
2489 -bc 0bc 1bc
2490 ---
2491 name: glob-range-2
2493 Test range matching
2495 file-setup: file 644 "abc"
2497 echo [a--]*
2498 expected-stdout:
2499 [a--]*
2500 ---
2501 name: glob-range-3
2504 # breaks on Mac OSX (HFS+ non-standard UTF-8 canonical decomposition)
2505 # breaks on Cygwin 1.7 (files are now UTF-16 or something)
2508 need-pass: no
2509 file-setup: file 644 "a�c"
2511 echo a[�-�]*
2512 expected-stdout:
2514 ---
2515 name: glob-range-4
2518 file-setup: file 644 ".bc"
2521 expected-stdout:
2523 ---
2524 name: glob-range-5
2527 (AT&T ksh treats this like [a-cc-e]*)
2528 file-setup: file 644 "abc"
2529 file-setup: file 644 "bbc"
2530 file-setup: file 644 "cbc"
2531 file-setup: file 644 "dbc"
2532 file-setup: file 644 "ebc"
2533 file-setup: file 644 "-bc"
2534 file-setup: file 644 "@bc"
2536 echo [a-c-e]*
2537 echo [a--@]*
2538 expected-stdout:
2539 -bc abc bbc cbc ebc
2541 ---
2542 name: glob-range-6
2545 file-setup: file 644 "abc"
2546 file-setup: file 644 "cbc"
2550 expected-stdout:
2553 expected-stderr-pattern: /.*/
2554 ---
2555 name: glob-word-1
2566 expected-stdout:
2573 ---
2574 name: glob-trim-1
2576 Check against a regression from fixing IFS-subst-2
2579 print -r "before='$x'"
2581 print -r "after ='$x'"
2582 expected-stdout:
2585 ---
2586 name: heredoc-1
2595 expected-stdout:
2597 ---
2598 name: heredoc-2
2600 Check quoted here-doc is protected.
2610 expected-stdout:
2616 ---
2617 name: heredoc-3
2619 Check that newline isn't needed after heredoc-delimiter marker.
2625 expected-stdout:
2628 ---
2629 name: heredoc-4a
2631 Check that an error occurs if the heredoc-delimiter is missing.
2636 expected-exit: e > 0
2637 expected-stderr-pattern: /.*/
2638 ---
2639 name: heredoc-4an
2641 Check that an error occurs if the heredoc-delimiter is missing.
2642 arguments: !-n!
2647 expected-exit: e > 0
2648 expected-stderr-pattern: /.*/
2649 ---
2650 name: heredoc-4b
2655 expected-exit: e > 0
2656 expected-stderr-pattern: /.*/
2657 ---
2658 name: heredoc-4bn
2661 arguments: !-n!
2664 expected-exit: e > 0
2665 expected-stderr-pattern: /.*/
2666 ---
2667 name: heredoc-5
2676 th\`echo not-run\`ere
2677 th\\`echo is-run`ere
2683 expected-stdout:
2686 th`echo not-run`ere
2687 th\is-runere
2691 ---
2692 name: heredoc-6
2694 Check that \newline in initial here-delim word doesn't imply
2695 a quoted here-doc.
2703 expected-stdout:
2706 ---
2707 name: heredoc-7
2720 expected-stdout:
2725 ---
2726 name: heredoc-8
2742 expected-stdout:
2749 ---
2750 name: heredoc-9
2757 "$__progname" -c "tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<foo"
2761 tr abcdefghijklmnopqrstuvwxyz nopqrstuvwxyzabcdefghijklm <<<-foo
2778 expected-stdout:
2785 -sbb
2801 ---
2802 name: heredoc-10
2805 category: !shell:ebcdic-yes
2815 vc=<<-EOF
2819 fnd=$(typeset -f foo)
2820 print -r -- "$fnd"
2832 print -r -- "| va={$va} vb={$vb} vc={$vc} vd={$vd} ve={$ve} vf={$vf} |"
2834 v=<<-EOF
2837 v+=<<-EOF
2840 print -r -- "| ${v//$'\n'/^} |"
2841 expected-stdout:
2843 vc=<<-EOF
2857 ---
2858 name: heredoc-10-ebcdic
2861 category: !shell:ebcdic-no
2871 vc=<<-EOF
2875 fnd=$(typeset -f foo)
2876 print -r -- "$fnd"
2888 print -r -- "| va={$va} vb={$vb} vc={$vc} vd={$vd} ve={$ve} vf={$vf} |"
2890 v=<<-EOF
2893 v+=<<-EOF
2896 print -r -- "| ${v//$'\n'/^} |"
2897 expected-stdout:
2899 vc=<<-EOF
2913 ---
2914 name: heredoc-11
2926 vc=<<-
2929 vd=<<-''
2933 fnd=$(typeset -f foo)
2934 print -r -- "$fnd"
2941 print -r -- "| va={$va} vb={$vb} vc={$vc} vd={$vd} |"
2944 typeset -f foo
2945 print -r -- "| vc={$vc} vd={$vd} |"
2947 v=<<-
2950 v+=<<-''
2953 print -r -- "| ${v//$'\n'/^} |"
2954 expected-stdout:
2956 vc=<<-
2960 vd=<<-""
2972 vc=<<-
2976 vd=<<-""
2985 ---
2986 name: heredoc-12
2993 set -- a b
3017 expected-stdout:
3030 ---
3031 name: heredoc-14
3041 foo 4<<-a <<-b 5<<-c
3049 x=$(typeset -f bar)
3051 y=$(typeset -f bar)
3053 typeset -f bar
3055 expected-stdout:
3058 \foo 4<<-a <<-b 5<<-c
3070 ---
3071 name: heredoc-15
3073 Check high-bit7 separators work
3076 tr a-z A-Z <<-
3080 expected-stdout:
3083 ---
3084 name: heredoc-comsub-1
3092 expected-stdout:
3094 ---
3095 name: heredoc-comsub-2
3103 expected-stdout:
3105 ---
3106 name: heredoc-comsub-3
3114 expected-stdout:
3116 ---
3117 name: heredoc-comsub-4
3125 expected-stdout:
3127 ---
3128 name: heredoc-comsub-5
3132 prefix() { sed -e "s/^/$1:/"; }
3133 XXX() { echo x-en; }
3134 YYY() { echo y-es; }
3146 expected-stdout:
3152 x-en
3153 ---
3154 name: heredoc-comsub-6
3162 y=$(<<-EOF
3170 expected-stdout:
3175 ---
3176 name: heredoc-subshell-1
3184 expected-stdout:
3187 ---
3188 name: heredoc-subshell-2
3197 expected-stdout:
3200 ---
3201 name: heredoc-subshell-3
3209 expected-stdout:
3212 ---
3213 name: heredoc-weird-1
3224 expected-stdout:
3228 ---
3229 name: heredoc-weird-2
3237 expected-stdout:
3240 ---
3241 name: heredoc-weird-4
3251 expected-stdout:
3254 ---
3255 name: heredoc-weird-5
3265 expected-stdout:
3269 ---
3270 name: heredoc-tmpfile-1
3277 cat <<- EOF
3281 cat <<- EOF
3288 expected-stdout:
3293 ---
3294 name: heredoc-tmpfile-2
3302 cat <<- EOF
3311 expected-stdout:
3315 ---
3316 name: heredoc-tmpfile-3
3324 cat <<- EOF
3331 cat <<- EOF
3340 expected-stdout:
3345 ---
3346 name: heredoc-tmpfile-4
3353 cat <<- EOF &
3359 expected-stdout:
3362 ---
3363 name: heredoc-tmpfile-5
3373 cat <<- EOF
3381 expected-stdout:
3386 ---
3387 name: heredoc-tmpfile-6
3394 cat <<- EOF | sed "s/hi/HI/"
3400 expected-stdout:
3403 ---
3404 name: heredoc-tmpfile-7
3411 cat <<- EOF | sed 's/hi/HI/' &
3417 expected-stdout:
3420 ---
3421 name: heredoc-tmpfile-8
3427 need-pass: no
3433 cat <<- EOF
3445 expected-stdout:
3451 ---
3452 name: heredoc-quoting-unsubst
3458 cat <<-'EOF'
3461 expected-stdout:
3463 ---
3464 name: heredoc-quoting-subst
3470 cat <<-EOF
3473 expected-stdout:
3475 ---
3476 name: single-quotes-in-braces
3482 expected-stdout:
3484 ---
3485 name: single-quotes-in-quoted-braces
3492 expected-stdout:
3494 ---
3495 name: single-quotes-in-braces-nested
3498 even if that's inside a double-quoted command expansion
3502 expected-stdout:
3504 ---
3505 name: single-quotes-in-brace-pattern
3511 expected-stdout:
3513 ---
3514 name: single-quotes-in-heredoc-braces
3523 expected-stdout:
3525 ---
3526 name: single-quotes-in-nested-braces
3533 expected-stdout:
3535 ---
3536 name: single-quotes-in-nested-quoted-braces
3543 expected-stdout:
3545 ---
3546 name: single-quotes-in-nested-braces-nested
3549 as quotes, even if that's inside a double-quoted command expansion
3553 expected-stdout:
3555 ---
3556 name: single-quotes-in-nested-brace-pattern
3562 expected-stdout:
3564 ---
3565 name: single-quotes-in-heredoc-nested-braces
3574 expected-stdout:
3576 ---
3577 name: single-quotes-in-heredoc-trim
3589 expected-stdout:
3595 ---
3596 name: history-basic
3598 See if we can test history at all
3599 need-ctty: yes
3600 arguments: !-i!
3601 env-setup: !ENV=./Env!HISTFILE=hist.file!
3602 file-setup: file 644 "Env"
3606 fc -l
3607 expected-stdout:
3610 expected-stderr-pattern:
3612 ---
3613 name: history-dups
3616 need-ctty: yes
3617 arguments: !-i!
3618 env-setup: !ENV=./Env!HISTFILE=hist.file!
3619 file-setup: file 644 "Env"
3625 fc -l
3626 expected-stdout:
3631 expected-stderr-pattern:
3633 ---
3634 name: history-unlink
3637 need-ctty: yes
3638 arguments: !-i!
3639 env-setup: !ENV=./Env!HISTFILE=foo/hist.file!
3640 file-setup: file 644 "Env"
3642 file-setup: dir 755 "foo"
3643 file-setup: file 644 "foo/hist.file"
3645 time-limit: 5
3646 perl-setup: chmod(0555, "foo");
3649 fc -l
3651 expected-stdout:
3654 expected-stderr-pattern:
3656 ---
3657 name: history-multiline
3660 need-ctty: yes
3661 arguments: !-i!
3662 env-setup: !ENV=./Env!
3663 file-setup: file 644 "Env"
3672 fc -l
3673 expected-stdout:
3685 expected-stderr-pattern:
3687 ---
3688 name: history-e-minus-1
3691 need-ctty: yes
3692 arguments: !-i!
3693 env-setup: !ENV=./Env!HISTFILE=hist.file!
3694 file-setup: file 644 "Env"
3699 fc -e -
3700 expected-stdout:
3704 expected-stderr-pattern:
3706 ---
3707 name: history-e-minus-2
3710 is re-executed.
3711 need-ctty: yes
3712 arguments: !-i!
3713 env-setup: !ENV=./Env!HISTFILE=hist.file!
3714 file-setup: file 644 "Env"
3720 fc -e -
3721 expected-stdout-pattern:
3723 expected-stderr-pattern:
3725 ---
3726 name: history-e-minus-3
3728 fc -e - fails when there is no history
3731 need-ctty: yes
3732 arguments: !-i!
3733 env-setup: !ENV=./Env!HISTFILE=hist.file!
3734 file-setup: file 644 "Env"
3737 fc -e -
3739 expected-stdout:
3741 expected-stderr-pattern:
3743 ---
3744 name: history-e-minus-4
3746 Check if "fc -e -" command output goes to stdout.
3747 need-ctty: yes
3748 arguments: !-i!
3749 env-setup: !ENV=./Env!HISTFILE=hist.file!
3750 file-setup: file 644 "Env"
3754 fc -e - | (read x; echo "A $x")
3756 expected-stdout:
3760 expected-stderr-pattern:
3762 ---
3763 name: history-e-minus-5
3766 need-ctty: yes
3767 arguments: !-i!
3768 env-setup: !ENV=./Env!HISTFILE=hist.file!
3769 file-setup: file 644 "Env"
3775 fc -e - echo
3776 fc -l 2 5
3777 expected-stdout:
3784 5 fc -l 2 5
3785 expected-stderr-pattern:
3787 ---
3788 name: history-list-1
3792 need-ctty: yes
3793 arguments: !-i!
3794 env-setup: !ENV=./Env!HISTFILE=hist.file!
3795 file-setup: file 644 "Env"
3801 fc -l -- -2
3802 expected-stdout:
3808 expected-stderr-pattern:
3810 ---
3811 name: history-list-2
3813 Lists oldest history if given pre-historic number
3816 need-ctty: yes
3817 arguments: !-i!
3818 env-setup: !ENV=./Env!HISTFILE=hist.file!
3819 file-setup: file 644 "Env"
3825 fc -l -- -40
3826 expected-stdout:
3833 expected-stderr-pattern:
3835 ---
3836 name: history-list-3
3839 need-ctty: yes
3840 arguments: !-i!
3841 env-setup: !ENV=./Env!HISTFILE=hist.file!
3842 file-setup: file 644 "Env"
3849 fc -l -3 -2
3850 expected-stdout:
3857 expected-stderr-pattern:
3859 ---
3860 name: history-list-4
3862 -1 refers to previous command
3863 need-ctty: yes
3864 arguments: !-i!
3865 env-setup: !ENV=./Env!HISTFILE=hist.file!
3866 file-setup: file 644 "Env"
3873 fc -l -1 -1
3874 expected-stdout:
3880 expected-stderr-pattern:
3882 ---
3883 name: history-list-5
3886 need-ctty: yes
3887 arguments: !-i!
3888 env-setup: !ENV=./Env!HISTFILE=hist.file!
3889 file-setup: file 644 "Env"
3896 fc -l -1 -1
3897 fc -l -2 -1
3898 expected-stdout:
3905 5 fc -l -1 -1
3906 expected-stderr-pattern:
3908 ---
3909 name: history-list-6
3913 need-ctty: yes
3914 arguments: !-i!
3915 env-setup: !ENV=./Env!HISTFILE=hist.file!HISTSIZE=3!
3916 file-setup: file 644 "Env"
3924 fc -l
3925 expected-stdout:
3933 expected-stderr-pattern:
3935 ---
3936 name: history-list-7
3939 need-ctty: yes
3940 arguments: !-i!
3941 env-setup: !ENV=./Env!HISTFILE=hist.file!HISTSIZE=3!
3942 file-setup: file 644 "Env"
3950 fc -l 1 30
3951 expected-stdout:
3959 6 fc -l 1 30
3960 expected-stderr-pattern:
3962 ---
3963 name: history-list-r-1
3965 test -r flag in history
3966 need-ctty: yes
3967 arguments: !-i!
3968 env-setup: !ENV=./Env!HISTFILE=hist.file!
3969 file-setup: file 644 "Env"
3977 fc -l -r 2 4
3978 expected-stdout:
3987 expected-stderr-pattern:
3989 ---
3990 name: history-list-r-2
3992 If first is newer than last, -r is implied.
3993 need-ctty: yes
3994 arguments: !-i!
3995 env-setup: !ENV=./Env!HISTFILE=hist.file!
3996 file-setup: file 644 "Env"
4004 fc -l 4 2
4005 expected-stdout:
4014 expected-stderr-pattern:
4016 ---
4017 name: history-list-r-3
4019 If first is newer than last, -r is cancelled.
4020 need-ctty: yes
4021 arguments: !-i!
4022 env-setup: !ENV=./Env!HISTFILE=hist.file!
4023 file-setup: file 644 "Env"
4031 fc -l -r 4 2
4032 expected-stdout:
4041 expected-stderr-pattern:
4043 ---
4044 name: history-subst-1
4047 need-ctty: yes
4048 arguments: !-i!
4049 env-setup: !ENV=./Env!HISTFILE=hist.file!
4050 file-setup: file 644 "Env"
4055 fc -e - abc=AB 'echo a'
4056 expected-stdout:
4060 expected-stderr-pattern:
4062 ---
4063 name: history-subst-2
4066 need-ctty: yes
4067 arguments: !-i!
4068 env-setup: !ENV=./Env!HISTFILE=hist.file!
4069 file-setup: file 644 "Env"
4074 fc -e - jkl=XYZQRT 'echo g'
4075 expected-stdout:
4079 expected-stderr-pattern:
4081 ---
4082 name: history-subst-3
4085 need-ctty: yes
4086 arguments: !-i!
4087 env-setup: !ENV=./Env!HISTFILE=hist.file!
4088 file-setup: file 644 "Env"
4093 fc -e - jkl=XYZQRT
4094 expected-stdout:
4098 expected-stderr-pattern:
4100 ---
4101 name: history-subst-4
4104 (ksh88 and ksh93 do not have -g option)
4105 need-ctty: yes
4106 arguments: !-i!
4107 env-setup: !ENV=./Env!HISTFILE=hist.file!
4108 file-setup: file 644 "Env"
4112 fc -e - -g a=FooBAR
4113 expected-stdout:
4116 expected-stderr-pattern:
4118 ---
4119 name: history-subst-5
4122 (ksh88/ksh93 don't have the ? prefix thing so they fail this test)
4123 need-ctty: yes
4124 arguments: !-i!
4125 env-setup: !ENV=./Env!HISTFILE=hist.file!
4126 file-setup: file 644 "Env"
4131 fc -e - abc=AB \?abc
4132 expected-stdout:
4136 expected-stderr-pattern:
4138 ---
4139 name: history-ed-1-old
4144 category: stdout-ed
4145 need-ctty: yes
4146 need-pass: no
4147 arguments: !-i!
4148 env-setup: !ENV=./Env!HISTFILE=hist.file!
4149 file-setup: file 644 "Env"
4157 expected-stdout:
4162 expected-stderr-pattern:
4164 ---
4165 name: history-ed-2-old
4168 category: stdout-ed
4169 need-ctty: yes
4170 need-pass: no
4171 arguments: !-i!
4172 env-setup: !ENV=./Env!HISTFILE=hist.file!
4173 file-setup: file 644 "Env"
4184 expected-stdout:
4192 expected-stderr-pattern:
4194 ---
4195 name: history-ed-3-old
4200 category: stdout-ed
4201 need-ctty: yes
4202 need-pass: no
4203 arguments: !-i!
4204 env-setup: !ENV=./Env!HISTFILE=hist.file!
4205 file-setup: file 644 "Env"
4216 fc -l
4217 expected-stdout:
4226 expected-stderr-pattern:
4228 ---
4229 name: history-ed-1
4233 category: !no-stderr-ed
4234 need-ctty: yes
4235 need-pass: no
4236 arguments: !-i!
4237 env-setup: !ENV=./Env!HISTFILE=hist.file!
4238 file-setup: file 644 "Env"
4246 expected-stdout:
4249 expected-stderr-pattern:
4251 ---
4252 name: history-ed-2
4255 category: !no-stderr-ed
4256 need-ctty: yes
4257 need-pass: no
4258 arguments: !-i!
4259 env-setup: !ENV=./Env!HISTFILE=hist.file!
4260 file-setup: file 644 "Env"
4271 expected-stdout:
4277 expected-stderr-pattern:
4279 ---
4280 name: history-ed-3
4284 category: !no-stderr-ed
4285 need-ctty: yes
4286 need-pass: no
4287 arguments: !-i!
4288 env-setup: !ENV=./Env!HISTFILE=hist.file!
4289 file-setup: file 644 "Env"
4300 fc -l
4301 expected-stdout:
4308 expected-stderr-pattern:
4310 ---
4311 name: IFS-space-1
4313 Simple test, default IFS
4315 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4316 set -- A B C
4321 expected-stdout:
4326 ---
4327 name: IFS-colon-1
4329 Simple test, IFS=:
4331 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4333 set -- A B C
4338 expected-stdout:
4343 ---
4344 name: IFS-null-1
4346 Simple test, IFS=""
4348 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4350 set -- A B C
4355 expected-stdout:
4360 ---
4361 name: IFS-space-colon-1
4363 Simple test, IFS=<white-space>:
4365 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4367 set --
4373 expected-stdout:
4379 ---
4380 name: IFS-space-colon-2
4382 Simple test, IFS=<white-space>:
4383 AT&T ksh fails this, POSIX says the test is correct.
4385 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4387 set --
4389 expected-stdout:
4391 ---
4392 name: IFS-space-colon-4
4394 Simple test, IFS=<white-space>:
4396 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4398 set --
4400 expected-stdout:
4402 ---
4403 name: IFS-space-colon-5
4405 Simple test, IFS=<white-space>:
4408 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4410 set --
4411 showargs "${@:-}"
4412 expected-stdout:
4414 ---
4415 name: IFS-subst-1
4417 Simple test, IFS=<white-space>:
4419 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4422 echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo
4423 echo -n '2:'; for i in :b:: ; do echo -n " [$i]" ; done ; echo
4427 echo -n '5:'; for i in $x ; do echo -n " [$i]" ; done ; echo
4430 echo -n '7:'; for i in $x ; do echo -n " [$i]" ; done ; echo
4432 echo -n '9:'; for i in ${FOO-`echo -n h:i`th:ere} ; do echo -n " [$i]" ; done ; echo
4433 showargs 10 ${FOO-`echo -n h:i`th:ere}
4434 showargs 11 "${FOO-`echo -n h:i`th:ere}"
4436 echo -n '12:'; for i in $x ; do echo -n " [$i]" ; done ; echo
4438 expected-stdout:
4452 ---
4453 name: IFS-subst-2
4457 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4460 expected-stdout:
4462 ---
4463 name: IFS-subst-3-arr
4465 Check leading IFS non-whitespace after trim does make a field
4468 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4469 showargs 0 ${-+}
4471 showargs 1 ${-+:foo:bar}
4473 showargs 2 ${-+ foo bar}
4474 expected-stdout:
4478 ---
4479 name: IFS-subst-3-ass
4481 Check non-field semantics
4483 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4484 showargs 0 x=${-+}
4486 showargs 1 x=${-+:foo:bar}
4488 showargs 2 x=${-+ foo bar}
4489 expected-stdout:
4493 ---
4494 name: IFS-subst-3-lcl
4496 Check non-field semantics, smaller corner case (LP#1381965)
4498 set -x
4499 local regex=${2:-}
4501 expected-exit: e != 0
4502 expected-stderr-pattern:
4504 ---
4505 name: IFS-subst-4-1
4509 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4512 IFS=\ ; set -- $a
4516 expected-stdout:
4528 ---
4529 name: IFS-subst-4-2
4533 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4536 IFS=\ ; set -- $a
4540 expected-stdout:
4552 ---
4553 name: IFS-subst-4-3
4557 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4560 IFS=\ ; set -- $a; IFS=
4565 print -nr -- '= qs '; pfn "$qs"
4566 print -nr -- '=nqs '; pfn "$nqs"
4567 print -nr -- '= qk '; pfn "$qk"
4568 print -nr -- '=nqk '; pfn "$nqk"
4569 print -nr -- '~ qs '; pfn "$*"
4570 print -nr -- '~nqs '; pfn $*
4571 print -nr -- '~ qk '; pfn "$@"
4572 print -nr -- '~nqk '; pfn $@
4573 expected-stdout:
4596 ---
4597 name: IFS-subst-4-4
4601 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4604 IFS=\ ; set -- $a; IFS=
4606 print -nr -- '= qs '; pfn "$qs"
4607 print -nr -- '~ qs '; pfn "$*"
4609 print -nr -- '=nqs '; pfn "$nqs"
4610 print -nr -- '~nqs '; pfn $*
4612 print -nr -- '= qk '; pfn "$qk"
4613 print -nr -- '~ qk '; pfn "$@"
4615 print -nr -- '=nqk '; pfn "$nqk"
4616 print -nr -- '~nqk '; pfn $@
4617 expected-stdout:
4640 ---
4641 name: IFS-subst-4-4p
4645 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4648 IFS=\ ; set -- $a; IFS=
4650 qs=${v:-"$*"}
4651 print -nr -- '= qs '; pfn "$qs"
4652 print -nr -- '~ qs '; pfn ${v:-"$*"}
4653 nqs=${v:-$*}
4654 print -nr -- '=nqs '; pfn "$nqs"
4655 print -nr -- '~nqs '; pfn ${v:-$*}
4656 qk=${v:-"$@"}
4657 print -nr -- '= qk '; pfn "$qk"
4658 print -nr -- '~ qk '; pfn ${v:-"$@"}
4659 nqk=${v:-$@}
4660 print -nr -- '=nqk '; pfn "$nqk"
4661 print -nr -- '~nqk '; pfn ${v:-$@}
4662 expected-stdout:
4685 ---
4686 name: IFS-subst-4-5
4690 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4693 IFS=\ ; set -- $a; IFS=,
4695 print -nr -- '= qs '; pfn "$qs"
4696 print -nr -- '~ qs '; pfn "$*"
4698 print -nr -- '=nqs '; pfn "$nqs"
4699 print -nr -- '~nqs '; pfn $*
4701 print -nr -- '= qk '; pfn "$qk"
4702 print -nr -- '~ qk '; pfn "$@"
4704 print -nr -- '=nqk '; pfn "$nqk"
4705 print -nr -- '~nqk '; pfn $@
4706 expected-stdout:
4729 ---
4730 name: IFS-subst-4-5p
4734 pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4737 IFS=\ ; set -- $a; IFS=,
4739 qs=${v:-"$*"}
4740 print -nr -- '= qs '; pfn "$qs"
4741 print -nr -- '~ qs '; pfn ${v:-"$*"}
4742 nqs=${v:-$*}
4743 print -nr -- '=nqs '; pfn "$nqs"
4744 print -nr -- '~nqs '; pfn ${v:-$*}
4745 qk=${v:-"$@"}
4746 print -nr -- '= qk '; pfn "$qk"
4747 print -nr -- '~ qk '; pfn ${v:-"$@"}
4748 nqk=${v:-$@}
4749 print -nr -- '=nqk '; pfn "$nqk"
4750 print -nr -- '~nqk '; pfn ${v:-$@}
4751 expected-stdout:
4774 ---
4775 name: IFS-subst-5
4777 extended testsuite based on IFS-subst-3
4779 - omit trailing field in a3zna, a7ina (unquoted $@ expansion)
4780 - has extra middle fields in b5ins, b7ina (IFS_NWS unquoted expansion)
4782 - omit leading field in a5ins, a7ina (IFS_NWS unquoted expansion)
4784 - differs in assignment, not expansion; probably zsh bug
4785 - has extra middle fields in b5ins, b7ina (IFS_NWS unquoted expansion)
4787 - a5ins (IFS_NWS unquoted $*)
4788 - b5ins, matching mksh’s
4791 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4792 IFS=; set -- "" 2 ""; pfb $*; x=$*; pfn "$x"'
4794 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4795 IFS=; set -- "" 2 ""; pfb "$*"; x="$*"; pfn "$x"'
4797 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4798 IFS=; set -- "" 2 ""; pfb $@; x=$@; pfn "$x"'
4800 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4801 IFS=; set -- "" 2 ""; pfb "$@"; x="$@"; pfn "$x"'
4803 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4804 IFS=,; set -- "" 2 ""; pfb $*; x=$*; pfn "$x"'
4806 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4807 IFS=,; set -- "" 2 ""; pfb "$*"; x="$*"; pfn "$x"'
4809 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4810 IFS=,; set -- "" 2 ""; pfb $@; x=$@; pfn "$x"'
4812 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4813 IFS=,; set -- "" 2 ""; pfb "$@"; x="$@"; pfn "$x"'
4815 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4816 IFS=; set -- A B "" "" C; pfb $*; x=$*; pfn "$x"'
4818 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4819 IFS=; set -- A B "" "" C; pfb "$*"; x="$*"; pfn "$x"'
4821 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4822 IFS=; set -- A B "" "" C; pfb $@; x=$@; pfn "$x"'
4824 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4825 IFS=; set -- A B "" "" C; pfb "$@"; x="$@"; pfn "$x"'
4827 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4828 IFS=,; set -- A B "" "" C; pfb $*; x=$*; pfn "$x"'
4830 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4831 IFS=,; set -- A B "" "" C; pfb "$*"; x="$*"; pfn "$x"'
4833 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4834 IFS=,; set -- A B "" "" C; pfb $@; x=$@; pfn "$x"'
4836 …"$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg…
4837 IFS=,; set -- A B "" "" C; pfb "$@"; x="$@"; pfn "$x"'
4839 expected-stdout:
4912 ---
4913 name: IFS-subst-6
4917 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4920 set -- a b
4922 expected-stdout:
4924 ---
4925 name: IFS-subst-7
4929 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4932 set -- '' c
4934 expected-stdout:
4936 ---
4937 name: IFS-subst-8
4941 n() { echo "$#"; }; n "${foo-$@}"
4942 expected-stdout:
4944 ---
4945 name: IFS-subst-9
4949 "$__progname" -c 'IFS=; set a b; [[ $* = "$1$2" ]]; echo 1 $?' sh a b
4950 "$__progname" -c 'IFS=; [[ $* = ab ]]; echo 2 "$?"' sh a b
4951 "$__progname" -c 'IFS=; [[ "$*" = ab ]]; echo 3 "$?"' sh a b
4952 "$__progname" -c 'IFS=; [[ $* = a ]]; echo 4 "$?"' sh a b
4953 "$__progname" -c 'IFS=; [[ "$*" = a ]]; echo 5 "$?"' sh a b
4954 "$__progname" -c 'IFS=; [[ "$@" = a ]]; echo 6 "$?"' sh a b
4955 "$__progname" -c 'IFS=; case "$@" in a) echo 7 a;; ab) echo 7 b;; a\ b) echo 7 ok;; esac' sh a b
4956 "$__progname" -c 'IFS=; case $* in a) echo 8 a;; ab) echo 8 ok;; esac' sh a b
4957 …"$__progname" -c 'pfsp() { for s_arg in "$@"; do print -nr -- "<$s_arg> "; done; print .; }; IFS=;…
4958 expected-stdout:
4968 ---
4969 name: IFS-subst-10
4973 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4974 set -- one "two three" four
4975 unset -v var
4978 set -- ${var=$*}
4982 expected-stdout:
4985 ---
4986 name: IFS-subst-11
4988 Check leading non-whitespace after trim makes only one field
4990 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4994 expected-stdout:
4996 ---
4997 name: IFS-arith-1
5002 ${BASH_VERSION+set -o posix}
5003 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
5006 expected-stdout:
5008 ---
5009 name: integer-base-err-1
5012 expected-exit: e != 0
5014 typeset -i i
5018 expected-stderr-pattern:
5020 ---
5021 name: integer-base-err-2
5024 (ksh88 fails this test)
5025 expected-exit: e != 0
5027 typeset -i i
5031 expected-stderr-pattern:
5033 ---
5034 name: integer-base-err-3
5038 (ksh88 fails this test - shell exits, even with -i)
5039 need-ctty: yes
5040 arguments: !-i!
5043 typeset -i4 a=10
5044 typeset -i a=2+
5046 typeset -i4 a=10
5047 typeset -i2 a=2+
5049 expected-stderr-pattern:
5051 expected-stdout:
5054 ---
5055 name: integer-base-err-4
5058 (ksh93 fails this test)
5059 expected-exit: e != 0
5061 typeset -i i;
5063 expected-stderr-pattern:
5065 ---
5066 name: integer-base-1
5070 typeset -i i
5074 expected-stdout:
5076 ---
5077 name: integer-base-2
5081 typeset -i i=8
5083 echo ---------- A
5084 typeset -i4 j=8
5086 echo ---------- B
5087 typeset -i k=8
5088 typeset -i4 k=8
5090 echo ---------- C
5091 typeset -i4 l
5094 echo ---------- D
5095 typeset -i m
5098 echo ---------- E
5100 typeset -i n
5104 echo ---------- F
5105 typeset -i8 o=12
5106 typeset -i4 o
5108 echo ---------- G
5109 typeset -i p
5112 expected-stdout:
5114 ---------- A
5116 ---------- B
5118 ---------- C
5120 ---------- D
5122 ---------- E
5125 ---------- F
5127 ---------- G
5129 ---
5130 name: integer-base-3
5132 More base parsing (hmm doesn't test much..)
5134 typeset -i aa
5137 typeset -i bb
5140 typeset -i bb
5143 typeset -i cc
5146 expected-stdout:
5151 ---
5152 name: integer-base-4
5155 also, check if base is not reset by -i with no arguments.
5156 (ksh93 fails - prints 10#20 - go figure)
5160 typeset -i | grep '^xx='
5161 typeset -i4 a=10
5162 typeset -i a=20
5164 expected-stdout:
5166 ---
5167 name: integer-base-5
5171 typeset -i4 a=3#10
5173 echo --
5174 typeset -i j=3
5177 echo --
5178 typeset -i k=1
5181 echo --
5182 typeset -i l
5184 expected-stdout:
5186 --
5187 -4
5188 --
5190 --
5194 ---
5195 name: integer-base-6
5198 (ksh93 fails this test - prints 0)
5200 typeset -i7 i
5203 expected-stdout:
5205 ---
5206 name: integer-base-7
5208 Check that non-integer parameters don't get bases assigned
5212 expected-stdout:
5215 ---
5216 name: integer-base-8
5218 Check that base-36 works (full span)
5221 typeset -i36 x=1691675
5223 typeset -Uui36 x
5225 expected-stdout:
5229 ---
5230 name: integer-base-check-flat
5232 Check behaviour does not match POSuX (except if set -o posix),
5233 because a not type-safe scripting language has *no* business
5236 echo 1 "$("$__progname" -c 'echo :$((10))/$((010)),$((0x10)):')" .
5237 echo 2 "$("$__progname" -o posix -c 'echo :$((10))/$((010)),$((0x10)):')" .
5238 echo 3 "$("$__progname" -o sh -c 'echo :$((10))/$((010)),$((0x10)):')" .
5239 expected-stdout:
5243 ---
5244 name: integer-base-check-numeric-from-1
5247 category: !shell:ebcdic-yes
5250 expected-stdout:
5252 ---
5253 name: integer-base-check-numeric-from-1-ebcdic
5256 category: !shell:ebcdic-no
5259 expected-stdout:
5261 ---
5262 name: integer-base-check-numeric-from-2
5270 echo 37:$($__progname -c 'echo $((37#10))').$?:
5271 expected-stdout:
5309 ---
5310 name: integer-base-check-numeric-to-1
5313 category: !shell:ebcdic-yes
5316 typeset -Uui$i x=0x40
5317 eval "typeset -i10 y=$x"
5319 expected-stdout:
5321 ---
5322 name: integer-base-check-numeric-to-1-ebcdic
5325 category: !shell:ebcdic-no
5328 typeset -Uui$i x=0x7C
5329 eval "typeset -i10 y=$x"
5331 expected-stdout:
5333 ---
5334 name: integer-base-check-numeric-to-2
5340 typeset -Uui$i x=0x40
5341 eval "typeset -i10 y=$x"
5344 expected-stdout:
5381 ---
5382 name: integer-arithmetic-span
5389 expected-stdout:
5390 s:-2147483648.-1.0.
5392 ---
5393 name: integer-arithmetic-span-64
5400 expected-stdout:
5401 s:-9223372036854775808.-1.0.
5403 ---
5404 name: integer-size-FAIL-to-detect
5410 ---
5411 name: lineno-stdin
5419 expected-stdout:
5423 ---
5424 name: lineno-inc
5427 file-setup: file 644 "dotfile"
5436 expected-stdout:
5442 ---
5443 name: lineno-func
5455 expected-stdout:
5461 ---
5462 name: lineno-unset
5464 See if unsetting LINENO makes it non-magic.
5465 file-setup: file 644 "dotfile"
5479 expected-stdout:
5487 ---
5488 name: lineno-unset-use
5490 See if unsetting LINENO makes it non-magic even
5491 when it is re-used.
5492 file-setup: file 644 "dotfile"
5507 expected-stdout:
5515 ---
5516 name: lineno-trap
5526 expected-stdout:
5528 expected-exit: 1
5529 ---
5530 name: lineno-eval-alias
5540 expected-stdout:
5547 ---
5548 name: unknown-trap
5557 ) 2>&1 | sed "s^${__progname%.exe}\.*e*x*e*: <stdin>\[[0-9]*]PROG"
5558 expected-stdout:
5567 ---
5568 name: read-IFS-1
5570 Simple test, default IFS
5576 echo 1a: ${z-z not set}
5579 expected-stdout:
5583 ---
5584 name: read-IFS-2
5586 Complex tests, IFS either colon (IFS-NWS) or backslash (tricky)
5589 showargs() { print -nr "$1"; shift; for s_arg in "$@"; do print -nr -- " [$s_arg]"; done; print; }
5592 print -r '<\>' | (IFS=\\ read f g; showargs 5 "$f" "$g")
5593 print -r '<\\>' | (IFS=\\ read f g; showargs 6 "$f" "$g")
5595 print -r '<\>' | (IFS=\\ read f; showargs 8 "$f")
5596 print -r '<\\>' | (IFS=\\ read f; showargs 9 "$f")
5598 print -r '<\>' | (IFS=\\ read -r f g; showargs 11 "$f" "$g")
5599 print -r '<\\>' | (IFS=\\ read -r f g; showargs 12 "$f" "$g")
5600 print '<\\\n>' | (IFS=\\ read -r f g; showargs 13 "$f" "$g")
5601 print -r '<\>' | (IFS=\\ read -r f; showargs 14 "$f")
5602 print -r '<\\>' | (IFS=\\ read -r f; showargs 15 "$f")
5603 print '<\\\n>' | (IFS=\\ read -r f; showargs 16 "$f")
5604 print -r '<:>' | (IFS=: read f g; showargs 17 "$f" "$g")
5605 print -r '<::>' | (IFS=: read f g; showargs 18 "$f" "$g")
5607 print -r '<:>' | (IFS=: read f; showargs 20 "$f")
5608 print -r '<::>' | (IFS=: read f; showargs 21 "$f")
5610 print -r '<:>' | (IFS=: read -r f g; showargs 23 "$f" "$g")
5611 print -r '<::>' | (IFS=: read -r f g; showargs 24 "$f" "$g")
5612 print '<:\n>' | (IFS=: read -r f g; showargs 25 "$f" "$g")
5613 print -r '<:>' | (IFS=: read -r f; showargs 26 "$f")
5614 print -r '<::>' | (IFS=: read -r f; showargs 27 "$f")
5615 print '<:\n>' | (IFS=: read -r f; showargs 28 "$f")
5616 expected-stdout:
5643 ---
5644 name: read-ksh-1
5651 expected-stdout:
5653 ---
5654 name: read-regress-1
5657 file-setup: file 644 "foo"
5667 expected-stdout:
5669 ---
5670 name: read-delim-1
5675 print -n 'foo bar\tbaz\nblah \0blub\tblech\nmyok meck \0'
5677 emit | while IFS= read -d "" foo; do print -r -- "<$foo>"; done
5678 emit | while read -d "" foo; do print -r -- "<$foo>"; done
5679 emit | while read -d "eh?" foo; do print -r -- "<$foo>"; done
5680 expected-stdout:
5693 ---
5694 name: read-ext-1
5696 Check read with number of bytes specified, and -A
5699 print -n x >x2
5702 x1b=u; read -N-1 x1b <x1
5704 x2b=u; read -N2 x2c <x2; r2b=$?
5705 x2c=u; read -n2 x2c <x2; r2c=$?
5706 x3a=u; read -A x3a <x3
5707 print -r "x1a=<$x1a>"
5708 print -r "x1b=<$x1b>"
5709 print -r "x2a=$r2a<$x2a>"
5710 print -r "x2b=$r2b<$x2b>"
5711 print -r "x2c=$r2c<$x2c>"
5712 print -r "x3a=<${x3a[0]}|${x3a[1]}|${x3a[2]}>"
5713 expected-stdout:
5721 ---
5722 name: regression-1
5729 expected-stdout:
5732 ---
5733 name: regression-2
5745 called - I don't know what this will break.
5747 : "${PWD:-`pwd 2> /dev/null`}"
5748 : "${PWD:?"PWD not set - cannot do test"}"
5753 # it as a built-in)
5762 expected-stdout:
5764 ---
5765 name: regression-6
5767 Parsing of $(..) expressions is non-optimal. It is
5770 $ ksh -c 'echo $(echo \( )'
5772 $ ksh -c 'echo $(echo "(" )'
5783 expected-stdout:
5786 ---
5787 name: regression-9
5803 break # hope break isn't broken too :-)
5810 expected-stdout:
5812 ---
5813 name: regression-10
5816 set -- `false`
5821 We honour POSIX except when -o sh is set.
5822 category: shell:legacy-no
5825 [[ -o posix ]]; FPOSIX=$((1-$?))
5826 [[ -o sh ]]; FSH=$((1-$?))
5827 echo -n "FPOSIX=$FPOSIX FSH=$FSH "
5831 set -- `false`
5833 set -o sh
5835 set -- `false`
5837 set -o posix
5839 set -- `false`
5841 set -o posix -o sh
5843 set -- `false`
5845 expected-stdout:
5850 ---
5851 name: regression-10-legacy
5854 set -- `false`
5859 category: shell:legacy-yes
5862 [[ -o posix ]]; FPOSIX=$((1-$?))
5863 [[ -o sh ]]; FSH=$((1-$?))
5864 echo -n "FPOSIX=$FPOSIX FSH=$FSH "
5868 set -- `false`
5870 set -o sh
5872 set -- `false`
5874 set -o posix
5876 set -- `false`
5878 set -o posix -o sh
5880 set -- `false`
5882 expected-stdout:
5887 ---
5888 name: regression-11
5897 expected-stdout:
5899 ---
5900 name: regression-12
5912 expected-stdout:
5915 ---
5916 name: regression-13
5925 NOTE: this test provokes a bizarre bug in ksh93 (shell starts reading
5927 time-limit: 10
5934 ---
5935 name: regression-14
5949 ---
5950 name: regression-15
5963 echo 2: $(whence does/not/exist | wc -l)
5964 echo 3: $(whence does/not/exist cat | wc -l)
5965 expected-stdout:
5969 ---
5970 name: regression-16
5991 expected-stdout:
5994 ---
5995 name: regression-17
5999 should set the exit status to non-zero (sh and AT&T ksh88 do).
6003 expected-exit: e != 0
6004 expected-stderr-pattern: /.?/
6005 ---
6006 name: regression-19
6017 expected-stdout:
6019 ---
6020 name: regression-21
6023 $ x='-x'
6025 -\?) echo hi
6028 $ x='-?'
6030 -\\?) echo hi
6035 case -x in
6036 -\?) echo fail
6038 ---
6039 name: regression-22
6047 expected-stdout:
6049 ---
6050 name: regression-23
6064 expected-stdout:
6066 ---
6067 name: regression-25
6077 expected-stdout:
6079 ---
6080 name: regression-26
6096 expected-stdout:
6098 ---
6099 name: regression-27
6107 expected-exit: e != 0
6108 expected-stderr-pattern: /does\/not\/exist/
6109 ---
6110 name: regression-28
6115 expected-exit: e != 0
6116 expected-stderr-pattern: /a\.x=1/
6117 ---
6118 name: regression-29
6124 expected-stdout:
6126 ---
6127 name: regression-30
6132 expected-exit: e != 0
6133 expected-stderr-pattern: /.?/
6134 ---
6135 name: regression-31
6151 expected-stdout:
6154 ---
6155 name: regression-32
6164 echo 1: ${x-x not set} ${y-y not set} ${z-z not set}
6169 expected-stdout:
6172 ---
6173 name: regression-33
6179 # now, the test proper
6182 expected-stdout:
6184 ---
6185 name: regression-35
6187 Temporay files used for here-docs in functions get trashed after
6191 cat <<- EOF
6195 cat <<- EOF
6202 unset -f f1
6204 expected-stdout:
6208 ---
6209 name: regression-36
6212 (test from <[email protected]>)
6218 c=`echo $line | wc -c`
6221 expected-stdout:
6225 ---
6226 name: regression-37
6232 expected-stderr-pattern: !/^\s*0\.0[\s\d]+real|^\s*real[\s]+0+\.0/
6233 ---
6234 name: regression-38
6236 set -e doesn't ignore exit codes for if/while/until/&&/||/!.
6237 arguments: !-e!
6244 expected-stdout:
6246 ---
6247 name: regression-39
6249 Only posh and oksh(2013-07) say “hi” below; FreeBSD sh,
6253 set -e
6254 echo `false; echo hi` $(<this-file-does-not-exist)
6256 expected-stdout:
6259 expected-stderr-pattern: /this-file-does-not-exist/
6260 ---
6261 name: regression-40
6264 env-setup: !RANDOM=12!
6267 expected-stdout:
6269 ---
6270 name: regression-41
6277 expected-stdout:
6279 ---
6280 name: regression-42
6284 print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
6285 'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
6286 done >env; chmod +x env; PATH=.$PATHSEP$PATH
6289 foo=stuff env | grep '^foo'
6290 expected-exit: e != 0
6291 expected-stderr-pattern:
6292 /read-only/
6293 ---
6294 name: regression-43
6300 ---
6301 name: regression-45
6313 expected-stdout:
6318 ---
6319 name: regression-46
6328 expected-stdout:
6331 ---
6332 name: regression-47
6340 expected-stdout:
6344 ---
6345 name: regression-48
6350 TMPDIR=$PWD/foo "$__progname" <<- 'EOF'
6359 echo=echo; [ -x /bin/echo ] && echo=/bin/echo
6360 exec $echo subtest-1 hi
6362 echo subtest-1 foo/*
6363 TMPDIR=$PWD/foo "$__progname" <<- 'EOF'
6364 echo=echo; [ -x /bin/echo ] && echo=/bin/echo
6365 sed 's/^/X /' << E_O_F; exec $echo subtest-2 hi
6371 echo subtest-2 foo/*
6372 expected-stdout:
6373 subtest-1 hi
6374 subtest-1 foo/*
6378 subtest-2 hi
6379 subtest-2 foo/*
6380 ---
6381 name: regression-49
6389 typeset -i BLAH
6393 expected-stdout:
6397 ---
6398 name: regression-50
6401 semi-colon.
6402 file-setup: file 644 "envf"
6405 env-setup: !ENV=./envf!
6406 need-ctty: yes
6407 arguments: !-i!
6412 expected-stdout:
6416 expected-stderr: !
6418 ---
6419 name: regression-51
6421 Check that set allows both +o and -o options on same command line.
6424 set -o noglob +o allexport
6426 expected-stdout:
6428 ---
6429 name: regression-52
6432 file-setup: file 644 "envf"
6434 file-setup: file 644 "abc"
6436 env-setup: !ENV=./envf!
6437 need-ctty: yes
6438 arguments: !-i!
6444 expected-stdout:
6449 expected-stderr: !
6451 ---
6452 name: regression-53
6486 set -- -f -b -k -l
6490 bfunc -BBB blah
6494 kfunc -KKK blah
6501 set -- -fbkl
6505 bfunc -BBB blah
6509 kfunc -KKK blah
6513 expected-stdout:
6516 bfunc: enter (args: -BBB blah; OPTIND=2)
6522 kfunc: enter (args: -KKK blah; OPTIND=1)
6532 bfunc: enter (args: -BBB blah; OPTIND=2)
6538 kfunc: enter (args: -KKK blah; OPTIND=1)
6545 ---
6546 name: regression-54
6553 if [[ -n 1 ]] then
6556 expected-stdout:
6559 ---
6560 name: regression-55
6573 expected-stdout:
6582 ---
6583 name: regression-57
6588 typeset -i xxx[4]
6590 typeset -i | grep xxx | sed 's/^/ /'
6596 typeset -i | grep xxx | sed 's/^/ /'
6599 expected-stdout:
6603 typeset -i xxx
6607 set -A xxx
6608 typeset -i xxx[1]
6609 ---
6610 name: regression-58
6616 expected-stdout:
6618 ---
6619 name: regression-59
6626 expected-stdout:
6628 ---
6629 name: regression-60
6639 expected-stdout:
6643 ---
6644 name: regression-61
6654 expected-stdout:
6664 ---
6665 name: regression-62
6667 Check if test -nt/-ot succeeds if second(first) file is missing.
6671 test a -nt b; a=$?
6672 test b -nt a; b=$?
6673 test a -ot b; c=$?
6674 test b -ot a; d=$?
6675 test a -nt a; e=$?
6676 test b -nt b; f=$?
6677 test a -ot a; g=$?
6678 test b -ot b; h=$?
6692 expected-stdout:
6698 ---
6699 name: regression-63
6704 echo FNORD-0
6716 echo FNORD-1
6718 echo FNORD-2
6719 export -p
6720 echo FNORD-3
6722 echo FNORD-4
6723 readonly -p
6724 echo FNORD-5
6726 echo FNORD-6
6727 typeset -p
6728 echo FNORD-7
6729 typeset -
6730 echo FNORD-8
6733 typeset -p fnord
6734 echo FNORD-9
6735 expected-stdout:
6736 FNORD-0
6737 FNORD-1
6742 FNORD-2
6747 FNORD-3
6752 FNORD-4
6757 FNORD-5
6759 typeset -r FNORD_B
6760 typeset -x FNORD_C
6761 typeset -x -r FNORD_D
6762 typeset -i FNORD_E
6763 typeset -i -r FNORD_F
6764 typeset -i -x FNORD_G
6765 typeset -i -x -r FNORD_H
6766 FNORD-6
6768 typeset -r FNORD_B=2
6769 typeset -x FNORD_C=3
6770 typeset -x -r FNORD_D=4
6771 typeset -i FNORD_E=5
6772 typeset -i -r FNORD_F=6
6773 typeset -i -x FNORD_G=7
6774 typeset -i -x -r FNORD_H=8
6775 FNORD-7
6784 FNORD-8
6785 set -A fnord
6788 FNORD-9
6789 ---
6790 name: regression-64
6801 ---
6802 name: regression-65
6806 time-limit: 5
6810 while read -p line; do :; done
6812 expected-stdout:
6814 ---
6815 name: regression-66
6824 set -A lines
6825 while IFS= read -pr line; do
6833 print -r -- "$line"
6835 expected-stdout:
6838 ---
6839 name: regression-67
6843 for s in s; do break; done; print -s s
6844 ---
6845 name: regression-68
6851 echo 3 $(( --a )) , $(( a-- )) , $(( a )) .
6858 echo 10 $(( a -= 4 )) .
6874 echo 26 $(( 5 % 5 )) , $(( 5 % 4 )) , $(( 5 % 1 )) , $(( 5 % -1 )) , $(( 5 % -2 )) .
6875 echo 27 $(( 5 + 2 )) , $(( 5 + 0 )) , $(( 5 + -2 )) .
6876 echo 28 $(( 5 - 2 )) , $(( 5 - 0 )) , $(( 5 - -2 )) .
6885 expected-stdout:
6919 34 -1 , -2 , 1 , 2 .
6922 ---
6923 name: regression-69
6925 Check that all non-lksh arithmetic operators work as expected
6926 category: shell:legacy-no
6933 expected-stdout:
6935 2 -2147483646 , -1073741822 .
6937 4 -2147483646 .
6938 ---
6939 name: export-1
6944 set -A qb 2 3
6945 set -a
6947 set -A qd 5 6
6948 export -p | grep '^export q'
6949 expected-stdout:
6953 ---
6954 name: readonly-0
6958 "$__progname" -c 'u=x; echo $? $u .' || echo aborted, $?
6960 "$__progname" -c 'readonly u; u=x; echo $? $u .' || echo aborted, $?
6962 "$__progname" -c 'u=x; readonly u; unset u; echo $? $u .' || echo aborted, $?
6963 expected-stdout:
6969 expected-stderr-pattern:
6970 /read-only/
6971 ---
6972 name: readonly-1
6976 "$__progname" -c 'readonly foo; export foo=a; echo $?' || echo aborted, $?
6977 expected-stdout:
6979 expected-stderr-pattern:
6980 /read-only/
6981 ---
6982 name: readonly-2a
6984 Check that getopts works as intended, for readonly-2b to be valid
6986 …"$__progname" -c 'set -- -a b; getopts a c; echo $? $c .; getopts a c; echo $? $c .' || echo abort…
6987 expected-stdout:
6990 ---
6991 name: readonly-2b
6995 "$__progname" -c 'readonly c; set -- -a b; getopts a c; echo $? $c .' || echo aborted, $?
6996 expected-stdout:
6998 expected-stderr-pattern:
6999 /read-only/
7000 ---
7001 name: readonly-3
7005 echo x | "$__progname" -c 'read s; echo $? $s .' || echo aborted, $?
7006 echo y | "$__progname" -c 'readonly s; read s; echo $? $s .' || echo aborted, $?
7007 expected-stdout:
7010 expected-stderr-pattern:
7011 /read-only/
7012 ---
7013 name: readonly-4
7017 set -A arr -- foo bar
7020 print -r -- "${arr[@]}"
7021 expected-exit: e != 0
7022 expected-stderr-pattern:
7023 /read[ -]?only/
7024 ---
7025 name: readonly-5
7031 ---
7032 name: syntax-1
7037 expected-exit: e != 0
7038 expected-stderr-pattern:
7040 ---
7041 name: xxx-quoted-newline-1
7048 expected-stdout:
7050 ---
7051 name: xxx-quoted-newline-2
7059 expected-stdout:
7061 ---
7062 name: xxx-quoted-newline-3
7070 expected-stdout:
7072 ---
7073 name: xxx-multi-assignment-cmd
7081 expected-stdout:
7083 ---
7084 name: xxx-multi-assignment-posix-cmd
7090 X=a Y=b; X=$Y Y=$X "$__progname" -c 'echo 1 $X $Y .'; echo 2 $X $Y .
7092 X=a Y=${X=b} Z=$X "$__progname" -c 'echo 3 $Z .'
7095 expected-stdout:
7100 ---
7101 name: xxx-multi-assignment-posix-nocmd
7108 expected-stdout:
7110 ---
7111 name: xxx-multi-assignment-posix-subassign
7114 - The assignment words shall be expanded in the current execution
7116 - The assignments happen in the temporary execution environment.
7119 Z=a Y=${X:=b} sh -c 'echo +$X+ +$Y+ +$Z+'
7123 X= Y=${X:=b} sh -c 'echo +$X+ +$Y+'
7125 expected-stdout:
7130 ---
7131 name: xxx-exec-environment-1
7135 print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
7136 'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
7137 done >env; chmod +x env; PATH=.$PATHSEP$PATH
7138 FOO=bar exec env
7139 expected-stdout-pattern:
7141 ---
7142 name: xxx-exec-environment-2
7145 isn't exec-ed
7147 print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
7148 'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
7149 done >env; chmod +x env; PATH=.$PATHSEP$PATH
7150 env >bar1
7151 FOO=bar exec; env >bar2
7152 cmp -s bar1 bar2
7153 ---
7154 name: exec-function-environment-1
7159 f() { a=2; }; g() { b=3; echo y$c-; }; a=1 f; b=2; c=1 g
7160 echo x$a-$b- z$c-
7161 expected-stdout:
7162 y1-
7163 x-3- z-
7164 ---
7165 name: exec-modern-korn-shell
7183 expected-stdout-pattern:
7185 ---
7186 name: exec-ksh88
7189 arguments: !-o!posix!
7204 expected-stdout-pattern:
7206 ---
7207 name: xxx-what-do-you-call-this-1
7209 echo "${foo:-"a"}*"
7210 expected-stdout:
7212 ---
7213 name: xxx-prefix-strip-1
7217 expected-stdout:
7219 ---
7220 name: xxx-prefix-strip-2
7225 expected-stdout:
7227 ---
7228 name: xxx-variable-syntax-1
7231 expected-stderr-pattern:
7233 expected-exit: 1
7234 ---
7235 name: xxx-variable-syntax-2
7239 expected-stderr-pattern:
7241 expected-exit: 1
7242 ---
7243 name: xxx-variable-syntax-3
7245 set -A foo 0
7247 expected-stderr-pattern:
7249 expected-exit: 1
7250 ---
7251 name: xxx-variable-syntax-4
7272 expected-stdout:
7285 ---
7286 name: xxx-substitution-eval-order
7291 set -A A abc def GHI j G k
7294 expected-stdout:
7297 ---
7298 name: xxx-substitution-eval-order-2
7318 expected-stdout:
7323 ---
7324 name: xxx-set-option-1
7328 set -vsA foo -- A 1 3 2
7330 expected-stderr:
7332 expected-stdout:
7334 ---
7335 name: xxx-exec-1
7337 Check that exec exits for built-ins
7338 need-ctty: yes
7339 arguments: !-i!
7343 expected-stdout:
7345 expected-stderr-pattern: /.*/
7346 ---
7347 name: xxx-while-1
7378 expected-stdout:
7382 ---
7383 name: xxx-status-1
7386 need-ctty: yes
7387 arguments: !-i!
7395 expected-stdout:
7398 expected-stderr-pattern: /.*/
7399 ---
7400 name: xxx-status-2
7418 expected-stdout:
7424 ---
7425 name: xxx-stat-1
7433 test -e a/b; echo 1e $? .
7434 test -f a/b; echo 1f $? .
7436 test -e a/b; echo 2e $? .
7437 test -f a/b; echo 2f $? .
7439 test -e a/b; echo 3e $? .
7440 test -f a/b; echo 3f $? .
7441 expected-stdout:
7448 ---
7449 name: xxx-clean-chars-1
7454 expected-stdout:
7456 ---
7457 name: xxx-param-subst-qmark-1
7466 expected-exit: 1
7467 expected-stderr-pattern: !/not set/
7468 ---
7469 name: xxx-param-subst-qmark-namespec
7474 "$__progname" -c "$@" >o1 2>o2
7477 sed -e "s^${__progname%.exe}\.*e*x*e*: PROG: " -e 's/^/STDOUT: /g' <o1
7478 sed -e "s^${__progname%.exe}\.*e*x*e*: PROG: " -e 's/^/STDERR: /g' <o2
7485 doit -u 'echo ${*:?}' foo ""
7486 expected-stdout:
7499 ---
7500 name: xxx-param-_-1
7502 category: !os:uwin-nt
7505 arguments: !-c!echo "[$-]"!
7506 expected-stdout-pattern: /^\[.*c.*\]$/
7507 ---
7508 name: tilde-expand-1
7511 env-setup: !HOME=/sweet!
7518 set -o posix
7525 expected-stdout:
7532 ---
7533 name: tilde-expand-2
7536 env-setup: !HOME=/sweet!
7545 plus=$(print -r -- ~+)
7546 minus=$(print -r -- ~-)
7547 nix=$(print -r -- ~)
7551 expected-stdout:
7556 ---
7557 name: tilde-expand-3
7561 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
7573 set -o posix
7588 set -o posix
7601 set -o posix
7617 command -- export a=~
7619 set -A bla
7621 typeset -g gbl=~ g2=$1
7627 set -o posix
7629 expected-stdout:
7651 ---
7652 name: exit-err-1
7656 print '#!'"$__progname"'\nexec "$1"' >env
7658 chmod +x env false
7660 set -ex
7661 env false && echo something
7663 expected-stdout:
7665 expected-stderr:
7666 + env false
7668 ---
7669 name: exit-err-2
7673 print '#!'"$__progname"'\nexec "$1"' >env
7676 chmod +x env false
7678 set -ex
7679 if env true; then
7680 env false && echo something
7683 expected-stdout:
7685 expected-stderr:
7686 + env true
7687 + env false
7689 ---
7690 name: exit-err-3
7693 TFM says: [set] -e | errexit
7698 set -e
7702 expected-stdout:
7705 expected-exit: e != 0
7706 ---
7707 name: exit-err-4
7709 "set -e" test suite (POSIX)
7711 set -e
7717 expected-stdout:
7720 ---
7721 name: exit-err-5
7723 "set -e" test suite (POSIX)
7725 set -e
7739 expected-stdout:
7743 ---
7744 name: exit-err-6
7746 "set -e" test suite (BSD make)
7753 set -e
7754-e; if [[ -d $wd/zd/$entry.i386 ]]; then _newdir_="$entry.i386"; else _newdir_="$entry"; fi; …
7755 expected-stdout:
7761 ---
7762 name: exit-err-7
7764 "set -e" regression (LP#1104543)
7766 set -e
7768 [ -x $PWD/nonexistant ] && $PWD/nonexistant
7773 expected-stdout:
7775 expected-exit: 1
7776 ---
7777 name: exit-err-8
7779 "set -e" regression (Debian #700526)
7781 set -e
7788 ---
7789 name: exit-err-9
7791 "set -e" versus bang pipelines
7793 set -e
7798 expected-stdout:
7800 expected-exit: 1
7801 ---
7802 name: exit-err-10
7804 Debian #269067 (cf. regression-38 but with eval)
7805 arguments: !-e!
7809 expected-stdout:
7811 ---
7812 name: exit-err-11
7814 Fix -e inside eval, from Martijn Dekker; expected-stdout from ksh93
7816 "$__progname" -c 'eval '\''echo ${-//[!eh]}; false; echo phantom e'\''; echo x$?'
7818 "$__progname" -ec 'eval '\''echo ${-//[!eh]}; false; echo phantom e'\''; echo x$?'
7820 expected-stdout:
7827 ---
7828 name: exit-enoent-1
7835 "$__progname" -c ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
7838 "$__progname" -c ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
7839 rm -f x
7841 "$__progname" -c ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
7842 expected-stdout:
7849 ---
7850 name: exit-eval-1
7873 echo -n "G "
7877 expected-stdout:
7886 ---
7887 name: exit-trap-1
7893 expected-stdout:
7895 expected-exit: 9
7896 ---
7897 name: exit-trap-2
7901 used to do) but (bug) continues “and out”, exit 0, in +e eval-undef.
7902 file-setup: file 644 "x"
7910 file-setup: file 644 "xt"
7918 file-setup: file 644 "xf"
7926 file-setup: file 644 "xu"
7936 rm -f rc
7941 -e 's/parameter not set/parameter null or not set/' \
7942 -e 's/[[]6]//' -e 's/: eval: line 1//' -e 's/: line 6//' \
7943 -e "s^${__progname%.exe}\.*e*x*e*: <stdin>\[[0-9]*]PROG"
7945 xe=-e
7948 echo = eval-true $(<rc) .
7950 echo = eval-false $(<rc) .
7952 echo = eval-undef $(<rc) .
7954 echo = noeval-true $(<rc) .
7956 echo = noeval-false $(<rc) .
7958 echo = noeval-undef $(<rc) .
7962 echo = eval-true $(<rc) .
7964 echo = eval-false $(<rc) .
7966 echo = eval-undef $(<rc) .
7968 echo = noeval-true $(<rc) .
7970 echo = noeval-false $(<rc) .
7972 echo = noeval-undef $(<rc) .
7973 expected-stdout:
7974 : -e
7978 = eval-true 0 .
7982 = eval-false 1 .
7986 = eval-undef 1 .
7990 = noeval-true 0 .
7994 = noeval-false 1 .
7998 = noeval-undef 1 .
8003 = eval-true 0 .
8009 = eval-false 0 .
8013 = eval-undef 1 .
8017 = noeval-true 0 .
8022 = noeval-false 0 .
8026 = noeval-undef 1 .
8027 ---
8028 name: exit-trap-3
8033 trap -- "echo $1 >&2" EXIT
8037 $(trap -- "echo comsub_exit >&2" EXIT)
8038 (trap -- "echo subshell_exit >&2" EXIT)
8039 expected-stderr:
8044 ---
8045 name: exit-trap-interactive
8048 arguments: !-i!
8050 trap -- EXIT
8059 expected-stdout:
8063 expected-stderr-pattern:
8065 ---
8066 name: test-stlt-1
8068 Check that test also can handle string1 < string2 etc.
8070 test 2005/10/08 '<' 2005/08/21 && echo ja || echo nein
8071 test 2005/08/21 \< 2005/10/08 && echo ja || echo nein
8072 test 2005/10/08 '>' 2005/08/21 && echo ja || echo nein
8073 test 2005/08/21 \> 2005/10/08 && echo ja || echo nein
8074 expected-stdout:
8079 expected-stderr-pattern: !/unexpected op/
8080 ---
8081 name: test-str-pattern
8085 [[ -n $BASH_VERSION ]] && shopt -s extglob
8087 n=$1 x=$2 y=$3 z=${4:-$3}
8113 expected-stdout:
8129 ---
8130 name: test-precedence-1
8134 test \( -f = -f \)
8137 expected-stdout:
8139 ---
8140 name: test-option-1
8142 Test the test -o operator
8145 test -o $1; echo $?
8146 [ -o $1 ]; echo $?
8147 [[ -o $1 ]]; echo $?
8150 test -o $1 -o -o !$1; echo $?
8151 [ -o $1 -o -o !$1 ]; echo $?
8152 [[ -o $1 || -o !$1 ]]; echo $?
8153 test -o ?$1; echo $?
8155 echo 0y $(if_test utf8-mode) =
8156 echo 0n $(if_test utf8-hack) =
8157 echo 1= $(runtest utf8-hack) =
8158 echo 2= $(runtest !utf8-hack) =
8159 echo 3= $(runtest ?utf8-hack) =
8161 echo 1+ $(runtest utf8-mode) =
8162 echo 2+ $(runtest !utf8-mode) =
8163 echo 3+ $(runtest ?utf8-mode) =
8164 set -U
8165 echo 1- $(runtest utf8-mode) =
8166 echo 2- $(runtest !utf8-mode) =
8167 echo 3- $(runtest ?utf8-mode) =
8169 echo 0y $(if_test -U) =
8171 echo 0n $(if_test -_) =
8172 echo 0n $(if_test -U-) =
8173 echo 1= $(runtest -_) =
8174 echo 2= $(runtest !-_) =
8175 echo 3= $(runtest ?-_) =
8177 echo 1+ $(runtest -U) =
8178 echo 2+ $(runtest !-U) =
8179 echo 3+ $(runtest ?-U) =
8183 set -U
8184 echo 1- $(runtest -U) =
8185 echo 2- $(runtest !-U) =
8186 echo 3- $(runtest ?-U) =
8187 echo 1- $(runtest +U) =
8188 echo 2- $(runtest !+U) =
8189 echo 3- $(runtest ?+U) =
8190 expected-stdout:
8199 1- 0 0 0 =
8200 2- 1 1 1 =
8201 3- 0 0 0 =
8216 1- 0 0 0 =
8217 2- 1 1 1 =
8218 3- 0 0 0 =
8219 1- 0 0 0 =
8220 2- 1 1 1 =
8221 3- 0 0 0 =
8222 ---
8223 name: test-varset-1
8225 Test the test -v operator
8227 [[ -v a ]]
8230 [[ -v a ]]
8233 [[ -v a ]]
8236 [[ -v a ]]
8239 [[ -v b ]]
8242 [[ -v b ]]
8245 [[ -v x ]]
8247 [[ -v x[0] ]]
8249 [[ -v x[1] ]]
8251 [[ -v x[2] ]]
8253 expected-stdout:
8264 ---
8265 name: test-varset-2
8267 test -v works only on scalars
8269 [[ -v x[*] ]]
8271 expected-exit: e != 0
8272 expected-stderr-pattern:
8274 ---
8275 name: test-stnze-1
8280 [ -n $x ]
8284 [ -n "$x" ]
8289 [ -n $x ]
8293 [ -n "$x" ]
8297 x='1 -a 1 = 2'
8298 [ -n $x ]
8302 [ -n "$x" ]
8306 expected-stdout:
8319 ---
8320 name: test-stnze-2
8325 [[ -n $x ]]
8329 [[ -n "$x" ]]
8334 [[ -n $x ]]
8338 [[ -n "$x" ]]
8342 x='1 -a 1 = 2'
8343 [[ -n $x ]]
8347 [[ -n "$x" ]]
8351 expected-stdout:
8364 ---
8365 name: test-numeq
8367 Check numeric -eq works (R40d regression); spotted by Martijn Dekker
8378 tst 1 'test 2 -eq 2'
8379 tst 2 'test 2 -eq 2a'
8380 tst 3 'test 2 -eq 3'
8381 tst 4 'test 2 -ne 2'
8382 tst 5 'test 2 -ne 2a'
8383 tst 6 'test 2 -ne 3'
8384 tst 7 'test \! 2 -eq 2'
8385 tst 8 'test \! 2 -eq 2a'
8386 tst 9 'test \! 2 -eq 3'
8387 expected-stdout:
8388 yepp 0 #1 test 2 -eq 2
8389 terr 2 #2 test 2 -eq 2a
8390 nope 1 #3 test 2 -eq 3
8391 nope 1 #4 test 2 -ne 2
8392 terr 2 #5 test 2 -ne 2a
8393 yepp 0 #6 test 2 -ne 3
8394 nope 1 #7 test \! 2 -eq 2
8395 terr 2 #8 test \! 2 -eq 2a
8396 yepp 0 #9 test \! 2 -eq 3
8397 expected-stderr-pattern:
8399 ---
8400 name: mkshrc-1
8406 expected-stdout:
8408 ---
8409 name: mkshrc-2a
8412 Part 2: verify mkshrc is not read (non-interactive shells)
8413 file-setup: file 644 ".mkshrc"
8415 env-setup: !HOME=.!ENV=!
8418 expected-stdout:
8420 ---
8421 name: mkshrc-2b
8425 file-setup: file 644 ".mkshrc"
8427 need-ctty: yes
8428 arguments: !-i!
8429 env-setup: !HOME=.!ENV=!PS1=!
8432 expected-stdout:
8434 expected-stderr-pattern:
8436 ---
8437 name: mkshrc-3
8441 file-setup: file 644 ".mkshrc"
8443 env-setup: !HOME=.!ENV=nonexistant!
8446 expected-stdout:
8448 ---
8449 name: sh-mode-1
8454 set -o braceexpand
8456 [[ -o sh ]] && echo sh
8457 [[ -o !sh ]] && echo nosh
8458 [[ -o braceexpand ]] && echo brex
8459 [[ -o !braceexpand ]] && echo nobrex
8463 set -o braceexpand
8465 set -o sh
8467 [[ -o sh ]] && echo sh
8468 [[ -o !sh ]] && echo nosh
8469 [[ -o braceexpand ]] && echo brex
8470 [[ -o !braceexpand ]] && echo nobrex
8471 set -o braceexpand
8473 [[ -o sh ]] && echo sh
8474 [[ -o !sh ]] && echo nosh
8475 [[ -o braceexpand ]] && echo brex
8476 [[ -o !braceexpand ]] && echo nobrex
8477 [[ $(exec -a -set "$__progname" -o) = *login+(' ')on* ]]; echo $?
8478 expected-stdout:
8491 ---
8492 name: sh-mode-2a
8497 for shell in {,-}{,r}{,k,mk}sh {,-}{,R}{,K,MK}SH.EXE; do
8498 ln -s "$__progname" ./$shell || cp "$__progname" ./$shell
8499 print -- $shell $(./$shell +l -c '
8500 [[ -o sh || -o posix ]] && echo sh
8501 [[ -o !sh && -o !posix ]] && echo nosh
8502 [[ -o restricted ]] && echo lim || echo ok
8505 expected-stdout:
8512 -sh nosh ok
8513 -ksh nosh ok
8514 -mksh nosh ok
8515 -rsh nosh lim
8516 -rksh nosh lim
8517 -rmksh nosh lim
8524 -SH.EXE nosh ok
8525 -KSH.EXE nosh ok
8526 -MKSH.EXE nosh ok
8527 -RSH.EXE nosh lim
8528 -RKSH.EXE nosh lim
8529 -RMKSH.EXE nosh lim
8530 ---
8531 name: sh-mode-2b
8536 for shell in {,-}{,r}{,k,mk}sh {,-}{,R}{,K,MK}SH.EXE; do
8537 ln -s "$__progname" ./$shell || cp "$__progname" ./$shell
8538 print -- $shell $(./$shell +l -c '
8539 [[ -o sh || -o posix ]] && echo sh
8540 [[ -o !sh && -o !posix ]] && echo nosh
8541 [[ -o restricted ]] && echo lim || echo ok
8544 expected-stdout:
8551 -sh sh ok
8552 -ksh nosh ok
8553 -mksh nosh ok
8554 -rsh sh lim
8555 -rksh nosh lim
8556 -rmksh nosh lim
8563 -SH.EXE sh ok
8564 -KSH.EXE nosh ok
8565 -MKSH.EXE nosh ok
8566 -RSH.EXE sh lim
8567 -RKSH.EXE nosh lim
8568 -RMKSH.EXE nosh lim
8569 ---
8570 name: sh-options
8575 [[ -o vi ]]; a=$?
8576 [[ -o pipefail ]]; b=$?
8579 set -e
8580 set -o vi
8586 set -o pipefail
8590 expected-stdout:
8594 ---
8595 name: pipeline-1
8598 subshell - make sure it still is, scripts depend on it
8599 file-setup: file 644 "abcx"
8600 file-setup: file 644 "abcy"
8607 set -o noglob
8612 expected-stdout:
8620 ---
8621 name: pipeline-2
8623 check that co-processes work with TCOMs, TPIPEs and TPARENs
8626 "$__progname" -c 'i=100; echo hi |& while read -p line; do echo "$((i++)) $line"; done'
8627 "$__progname" -c 'i=200; echo hi | cat |& while read -p line; do echo "$((i++)) $line"; done'
8628 "$__progname" -c 'i=300; (echo hi | cat) |& while read -p line; do echo "$((i++)) $line"; done'
8629 expected-stdout:
8633 ---
8634 name: pipeline-3
8646 expected-stdout:
8655 ---
8656 name: pipeline-4
8658 Check that "set -o pipefail" does what it's supposed to
8660 echo 1 "$("$__progname" -c '(exit 12) | (exit 23) | (exit 42); echo $?')" .
8661 echo 2 "$("$__progname" -c '! (exit 12) | (exit 23) | (exit 42); echo $?')" .
8662 echo 3 "$("$__progname" -o pipefail -c '(exit 12) | (exit 23) | (exit 42); echo $?')" .
8663 echo 4 "$("$__progname" -o pipefail -c '! (exit 12) | (exit 23) | (exit 42); echo $?')" .
8664 echo 5 "$("$__progname" -c '(exit 23) | (exit 42) | :; echo $?')" .
8665 echo 6 "$("$__progname" -c '! (exit 23) | (exit 42) | :; echo $?')" .
8666 echo 7 "$("$__progname" -o pipefail -c '(exit 23) | (exit 42) | :; echo $?')" .
8667 echo 8 "$("$__progname" -o pipefail -c '! (exit 23) | (exit 42) | :; echo $?')" .
8668 echo 9 "$("$__progname" -o pipefail -c 'x=$( (exit 23) | (exit 42) | :); echo $?')" .
8669 expected-stdout:
8679 ---
8680 name: persist-history-1
8683 category: !no-histfile
8684 need-ctty: yes
8685 arguments: !-i!
8686 env-setup: !ENV=./Env!HISTFILE=hist.file!
8687 file-setup: file 644 "Env"
8691 expected-stdout-pattern:
8693 expected-stderr-pattern:
8695 ---
8696 name: typeset-1
8698 Check that typeset -g works correctly
8700 set -A arrfoo 65
8702 typeset -g -Uui16 arrfoo[*]
8707 set -A arrbar 65
8712 typeset -g -Uui16 arrbar[*]
8720 expected-stdout:
8729 ---
8730 name: typeset-2
8732 Check that typeset -p on arrays works correctly
8734 set -A x -- a b c
8736 typeset -p x
8738 typeset -p x[1]
8739 expected-stdout:
8741 set -A x
8747 ---
8748 name: typeset-padding-1
8752 typeset -L10 ln=0hall0
8753 typeset -R10 rn=0hall0
8754 typeset -ZL10 lz=0hall0
8755 typeset -ZR10 rz=0hall0
8756 typeset -Z10 rx=" hallo "
8758 expected-stdout:
8760 ---
8761 name: typeset-padding-2
8763 Check if base-!10 integers are padded right
8765 typeset -Uui16 -L9 ln=16#1
8766 typeset -Uui16 -R9 rn=16#1
8767 typeset -Uui16 -Z9 zn=16#1
8768 typeset -L9 ls=16#1
8769 typeset -R9 rs=16#1
8770 typeset -Z9 zs=16#1
8772 expected-stdout:
8774 ---
8775 name: typeset-padding-3
8777 Check for a regression in which UTF-8 wasn’t left-padded right
8779 set -U
8781 typeset -L20 x='. ak'
8782 typeset -R20 y='. ak'
8783 print -r -- "<$x> (1$nl<12345678910 345678920$nl<$y> 1)"
8784 typeset -L20 x='. aẞ'
8785 typeset -R20 y='. aẞ'
8786 print -r -- "<$x> (2$nl<12345678910 345678920$nl<$y> 2)"
8787 expected-stdout:
8794 ---
8795 name: utf8bom-1
8797 Check that the UTF-8 Byte Order Mark is ignored as the first
8798 multibyte character of the shell input (with -c, from standard
8800 # breaks on Mac OSX (HFS+ non-standard UTF-8 canonical decomposition)
8801 category: !os:darwin,!shell:ebcdic-yes
8808 set -A anzahl -- foo/*
8812 "$__progname" -c 'fnord'
8814 "$__progname" -c 'fnord; fnord; fnord; fnord'
8822 "$__progname" -c 'echo : $(fnord)'
8823 rm -rf foo
8824 expected-stdout:
8849 ---
8850 name: utf8bom-2
8852 Check that we can execute BOM-shebangs (failures not fatal)
8855 note: Ultrix perl5 t4 returns 65280 (exit-code 255) and no text
8856 note: A/UX perl5 returns 6400 (exit-code 25), passes #1-3
8857 XXX fails when LD_PRELOAD is set with -e and Perl chokes it (ASan)
8858 need-pass: no
8859 category: !os:aux,!os:cygwin,!os:midipix,!os:msys,!os:ultrix,!os:uwin-nt,!smksh
8860 env-setup: !FOO=BAR!
8862 print '#!'"$__progname"'\nprint "1 a=$ENV{FOO}";' >t1
8863 print '#!'"$__progname"'\nprint "2 a=$ENV{FOO}";' >t2
8864 print '#!'"$__perlname"'\nprint "3 a=$ENV{FOO}\n";' >t3
8865 print '#!'"$__perlname"'\nprint "4 a=$ENV{FOO}\n";' >t4
8871 expected-stdout:
8876 expected-stderr-pattern:
8878 ---
8879 name: utf8opt-1
8881 Check that the utf8-mode flag is not set at non-interactive startup
8882 env-setup: !PS1=!PS2=!LC_CTYPE=@utflocale@!
8884 if [[ $- = *U* ]]; then
8889 expected-stdout:
8891 ---
8892 name: utf8opt-2
8894 Check that the utf8-mode flag is set at interactive startup.
8896 need-pass: no
8898 need-ctty: yes
8899 arguments: !-i!
8900 env-setup: !PS1=!PS2=!LC_CTYPE=@utflocale@!
8902 if [[ $- = *U* ]]; then
8907 expected-stdout:
8909 expected-stderr-pattern:
8911 ---
8912 name: utf8opt-3a
8918 code='if [[ $- = *U* ]]; then echo $i on; else echo $i off; fi'
8919 let i++; "$__progname" -U -c "$code"
8920 let i++; "$__progname" +U -c "$code"
8922 expected-stdout:
8926 ---
8927 name: utf8opt-3b
8930 need-ctty: yes
8933 code='if [[ $- = *U* ]]; then echo $i on; else echo $i off; fi'
8934 let i++; "$__progname" -U -ic "$code"
8935 let i++; "$__progname" +U -ic "$code"
8937 expected-stdout:
8941 ---
8942 name: utf8bug-1
8946 set -U
8950 print -r -- "<e$x>"
8953 print -r -- "<e$x>"
8957 print -r -- "<e$x>"
8958 expected-stdout:
8962 ---
8963 name: aliases-1
8965 Check if built-in shell aliases are okay
8968 typeset -f
8969 expected-stdout:
8970 autoload='\\builtin typeset -fu'
8971 functions='\\builtin typeset -f'
8972 hash='\\builtin alias -t'
8973 history='\\builtin fc -l'
8974 integer='\\builtin typeset -i'
8977 nameref='\\builtin typeset -n'
8979 r='\\builtin fc -e -'
8980 type='\\builtin whence -v'
8981 ---
8982 name: aliases-2b
8984 Check if “set -o sh” does not influence built-in aliases
8985 arguments: !-o!sh!
8988 typeset -f
8989 expected-stdout:
8990 autoload='\\builtin typeset -fu'
8991 functions='\\builtin typeset -f'
8992 hash='\\builtin alias -t'
8993 history='\\builtin fc -l'
8994 integer='\\builtin typeset -i'
8997 nameref='\\builtin typeset -n'
8999 r='\\builtin fc -e -'
9000 type='\\builtin whence -v'
9001 ---
9002 name: aliases-3b
9004 Check if running as sh does not influence built-in aliases
9007 ./sh -c 'alias; typeset -f'
9008 rm -f sh
9009 expected-stdout:
9010 autoload='\\builtin typeset -fu'
9011 functions='\\builtin typeset -f'
9012 hash='\\builtin alias -t'
9013 history='\\builtin fc -l'
9014 integer='\\builtin typeset -i'
9017 nameref='\\builtin typeset -n'
9019 r='\\builtin fc -e -'
9020 type='\\builtin whence -v'
9021 ---
9022 name: aliases-cmdline
9029 "$__progname" -c $'alias a="echo OK"\na'
9030 expected-stdout:
9032 ---
9033 name: aliases-funcdef-1
9042 expected-stdout:
9044 ---
9045 name: aliases-funcdef-2
9054 expected-stdout:
9056 ---
9057 name: aliases-funcdef-3
9066 expected-stdout:
9068 ---
9069 name: aliases-funcdef-4
9076 expected-stdout:
9079 ---
9080 name: arrays-1
9085 set -A foo -- a \$v "$v" '$v' b
9087 expected-stdout:
9089 ---
9090 name: arrays-2a
9092 Check if bash-style arrays work as expected
9097 expected-stdout:
9099 ---
9100 name: arrays-2b
9102 Check if bash-style arrays work as expected, with newlines
9104 print '#!'"$__progname"'\nfor x in "$@"; do print -nr -- "$x|"; done' >pfp
9106 test -n "$ZSH_VERSION" && setopt KSH_ARRAYS
9123 expected-stdout:
9127 ---
9128 name: arrays-3
9132 set -A foo a b c
9136 foo[-1]=f
9138 expected-stdout:
9141 ---
9142 name: arrays-4
9147 set -A foo -- [1]=\$v [2]="$v" [4]='$v' [0]=a [5]=b
9151 set -A arr "[5]=meh"
9153 expected-stdout:
9156 ---
9157 name: arrays-5
9159 Check if bash-style arrays with specified indices work as expected
9160 (taken out temporarily to fix arrays-4; see also arrays-9a comment)
9172 typeset -a arr
9175 expected-stdout:
9180 ---
9181 name: arrays-6
9189 echo -n "$((i++))<$x>"
9208 expected-stdout:
9223 ---
9224 name: arrays-7
9240 expected-stdout:
9250 ---
9251 name: arrays-8
9256 set -A aa 9
9260 set -A ab 9
9264 set -A ac 91
9266 set -A ac 92
9283 set -A aa 1 2
9284 set -A ab 1 2
9285 set -A ac 1 2
9286 set -A ad 1 2
9287 set -A ae 1 2
9288 set -A af 1 2
9289 set -A ag 1 2
9290 set -A ah 1 2
9291 typeset -Z3 aa ab ac ad ae af ag
9307 typeset -Z5 ah[*]
9316 expected-stdout:
9333 ---
9334 name: arrays-9a
9341 expected-stdout:
9345 ---
9346 name: arrays-9b
9351 unset foo; typeset -i16 foo=10; foo+=20; echo 2 $foo .
9352 expected-stdout:
9355 ---
9356 name: arrassign-basic
9372 expected-stdout:
9377 ---
9378 name: arrassign-eol
9382 foo=(a b) env
9383 expected-exit: e != 0
9384 expected-stderr-pattern:
9385 /syntax error: unexpected 'env'/
9386 ---
9387 name: arrassign-fnc-none
9396 if [[ -n $BASH_VERSION ]]; then
9399 set -A y
9416 expected-stdout:
9427 ---
9428 name: arrassign-fnc-local
9440 if [[ -n $BASH_VERSION ]]; then
9443 set -A y
9451 if [[ -n $BASH_VERSION ]]; then
9454 set -A z
9477 expected-stdout:
9493 ---
9494 name: arrassign-fnc-global
9497 with the bash4/mksh/yash/zsh typeset -g keyword
9500 typeset -g x
9505 set -A y
9506 typeset -g y
9511 typeset -g z
9512 set -A z
9534 expected-stdout:
9550 ---
9551 name: strassign-fnc-none
9576 expected-stdout:
9587 ---
9588 name: strassign-fnc-local
9629 expected-stdout:
9645 ---
9646 name: strassign-fnc-global
9649 with the bash4/mksh/yash/zsh typeset -g keyword
9652 typeset -g x
9658 typeset -g y
9663 typeset -g z
9686 expected-stdout:
9702 ---
9703 name: unset-fnc-local-ksh
9724 expected-stdout:
9732 ---
9733 name: unset-fnc-local-sh
9754 expected-stdout:
9762 ---
9763 name: varexpand-substr-1
9765 Check if bash-style substring expansion works
9769 typeset -i y=123456789
9770 typeset -i 16 z=123456789 # 16#75bcd15
9778 expected-stdout:
9786 ---
9787 name: varexpand-substr-2
9789 Check if bash-style substring expansion works
9793 typeset -i y=123456789
9794 typeset -i 16 z=123456789 # 16#75bcd15
9798 echo c ${x:(-2):1} ${y:(-2):1} ${z:(-2):1} c
9800 expected-stdout:
9805 ---
9806 name: varexpand-substr-3
9811 "$__progname" -c 'echo v${x:(n)}x'
9812 "$__progname" -c 'echo w${x: n}x'
9813 "$__progname" -c 'echo x${x:n}x'
9814 "$__progname" -c 'echo y${x:}x'
9815 "$__progname" -c 'echo z${x}x'
9816 "$__progname" -c 'x=abcdef;y=123;echo q${x:${y:2:1}:2}q'
9817 expected-stdout:
9823 expected-stderr-pattern:
9825 ---
9826 name: varexpand-substr-4
9833 expected-stdout:
9835 ---
9836 name: varexpand-substr-5A
9842 echo a ${x::1} ${x: -1} a
9843 echo b ${x::3} ${x: -3} b
9844 echo c ${x:1:2} ${x: -3:2} c
9846 expected-stdout:
9851 ---
9852 name: varexpand-substr-5W
9856 set -U
9858 echo a ${x::1} ${x: -1} a
9859 echo b ${x::2} ${x: -2} b
9860 echo c ${x:1:1} ${x: -2:1} c
9862 expected-stdout:
9867 ---
9868 name: varexpand-substr-6
9879 expected-stdout:
9884 ---
9885 name: varexpand-special-hash
9888 category: !shell:ebcdic-yes
9890 typeset -i8 foo=10
9894 expected-stdout:
9896 ---
9897 name: varexpand-special-hash-ebcdic
9900 category: !shell:ebcdic-no
9902 typeset -i8 foo=10
9906 expected-stdout:
9908 ---
9909 name: varexpand-special-quote
9912 category: !shell:faux-ebcdic
9919 print -r -- "<i=$i j=$j k=$k>"
9921 print -r -- "s=\"$s\""
9923 typeset -p u v w
9924 expected-stdout:
9931 ---
9932 name: varexpand-special-quote-faux-EBCDIC
9935 category: shell:faux-ebcdic
9942 print -r -- "<i=$i j=$j k=$k>"
9944 print -r -- "s=\"$s\""
9946 typeset -p u v w
9947 expected-stdout:
9954 ---
9955 name: varexpand-null-1
9966 expected-stdout:
9974 ---
9975 name: varexpand-null-2
9979 print '#!'"$__progname"'\nfor x in "$@"; do print -nr -- "<$x> "; done' >pfs
9983 expected-stdout:
9985 ---
9986 name: varexpand-null-3
9990 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
9996 set -- a b
10003 set --
10010 expected-stdout:
10026 ---
10027 name: varexpand-funny-chars
10032 x=$'<\x00>'; typeset -p x
10033 x=$'<\x01>'; typeset -p x
10034 x=$'<\u0000>'; typeset -p x
10035 x=$'<\u0001>'; typeset -p x
10036 expected-stdout:
10041 ---
10042 name: print-funny-chars
10053 # integer-base-one-3Ar
10054 typeset -Uui16 -Z11 pos=0
10055 typeset -Uui16 -Z5 hv=2147483647
10057 if read -arN -1 line; then
10058 typeset -i1 line
10063 (( pos )) && print -r -- "$dasc|"
10064 print -n "${pos#16#} "
10067 print -n "${hv#16#} "
10071 dasc=$dasc${line[i-1]#1#}
10073 (( (pos++ & 15) == 7 )) && print -n -- '- '
10077 print -n ' '
10078 (( (pos++ & 15) == 7 )) && print -n -- '- '
10080 (( hv == 2147483647 )) || print -r -- "$dasc|"
10082 expected-stdout:
10083 00000000 3C 64 E4 DB C3 9B E2 82 - AC C3 9B 40 3E 0A 3C 00 |<d.........@>.<.|
10084 00000010 3E 0A 3C 01 3E 0A 3C 00 - 3E 0A 3C 01 3E 0A |>.<.>.<.>.<.>.|
10085 ---
10086 name: print-bksl-c
10091 expected-stdout:
10093 ---
10094 name: print-cr
10099 cat >>foo <<-'EOF'
10100 …print -n -- '220-blau.mirbsd.org ESMTP ready at Thu, 25 Jul 2013 15:57:57 GMT\r\n220->> Bitte kein…
10105 ./foo | while IFS= read -r line; do
10106 print -r -- "{$line}"
10108 expected-stdout:
10109 [220-blau.mirbsd.org ESMTP ready at Thu, 25 Jul 2013 15:57:57 GMT
10110 220->> Bitte keine Werbung einwerfen! <<
10114 {220-blau.mirbsd.org ESMTP ready at Thu, 25 Jul 2013 15:57:57 GMT
10116 {220->> Bitte keine Werbung einwerfen! <<
10121 ---
10122 name: print-crlf
10124 Check that CR+LF is shown and read as-is
10125 category: shell:textmode-no
10127 cat >foo <<-'EOF'
10131 if test x"$KSH_VERSION" = x""; then #
10134 print -nr -- "<$x>" #
10138 "$__progname" foo | while IFS= read -r line; do
10139 print -r -- "{$line}"
10141 expected-stdout:
10148 ---
10149 name: print-crlf-textmode
10152 category: shell:textmode-yes
10154 cat >foo <<-'EOF'
10158 if test x"$KSH_VERSION" = x""; then #
10161 print -nr -- "<$x>" #
10165 "$__progname" foo | while IFS= read -r line; do
10166 print -r -- "{$line}"
10168 expected-stdout:
10174 ---
10175 name: print-lf
10177 Check that LF-only is shown and read as-is
10179 cat >foo <<-'EOF'
10183 if test x"$KSH_VERSION" = x""; then #
10186 print -nr -- "<$x>" #
10190 "$__progname" foo | while IFS= read -r line; do
10191 print -r -- "{$line}"
10193 expected-stdout:
10199 ---
10200 name: print-nul-chars
10205 print $(($(print '<\0>' | wc -c))) $(($(print "$x" | wc -c))) \
10207 expected-stdout-pattern:
10209 ---
10210 name: print-array
10212 Check that print -A works as expected
10214 print -An 0x20AC 0xC3 0xBC 8#101
10215 set -U
10216 print -A 0x20AC 0xC3 0xBC 8#102
10217 expected-stdout:
10219 ---
10220 name: print-escapes
10224 print '\ \!\"\#\$\%\&'\\\''\(\)\*\+\,\-\.\/\0\1\2\3\4\5\6\7\8' \
10229 # integer-base-one-3As
10230 typeset -Uui16 -Z11 pos=0
10231 typeset -Uui16 -Z5 hv=2147483647
10232 typeset -i1 wc=0x0A
10235 while IFS= read -r line; do
10237 while [[ -n $line ]]; do
10240 (( pos )) && print -r -- "$dasc|"
10241 print -n "${pos#16#} "
10244 print -n "${hv#16#} "
10250 (( (pos++ & 15) == 7 )) && print -n -- '- '
10255 print -n ' '
10256 (( (pos++ & 15) == 7 )) && print -n -- '- '
10258 (( hv == 2147483647 )) || print -r -- "$dasc|"
10260 expected-stdout:
10261 00000000 5C 20 5C 21 5C 22 5C 23 - 5C 24 5C 25 5C 26 5C 27 |\ \!\"\#\$\%\&\'|
10262 00000010 5C 28 5C 29 5C 2A 5C 2B - 5C 2C 5C 2D 5C 2E 5C 2F |\(\)\*\+\,\-\.\/|
10263 00000020 5C 31 5C 32 5C 33 5C 34 - 5C 35 5C 36 5C 37 5C 38 |\1\2\3\4\5\6\7\8|
10264 00000030 20 5C 39 5C 3A 5C 3B 5C - 3C 5C 3D 5C 3E 5C 3F 5C | \9\:\;\<\=\>\?\|
10265 00000040 40 5C 41 5C 42 5C 43 5C - 44 1B 5C 46 5C 47 5C 48 |@\A\B\C\D.\F\G\H|
10266 00000050 5C 49 5C 4A 5C 4B 5C 4C - 5C 4D 5C 4E 5C 4F 5C 50 |\I\J\K\L\M\N\O\P|
10267 00000060 5C 51 5C 52 5C 53 5C 54 - 20 5C 55 5C 56 5C 57 5C |\Q\R\S\T \U\V\W\|
10268 00000070 58 5C 59 5C 5A 5C 5B 5C - 5C 5D 5C 5E 5C 5F 5C 60 |X\Y\Z\[\\]\^\_\`|
10269 00000080 07 08 20 20 5C 64 1B 0C - 5C 67 5C 68 5C 69 5C 6A |.. \d..\g\h\i\j|
10270 00000090 5C 6B 5C 6C 5C 6D 0A 5C - 6F 5C 70 20 5C 71 0D 5C |\k\l\m.\o\p \q.\|
10271 000000A0 73 09 5C 75 0B 5C 77 5C - 78 5C 79 5C 7A 5C 7B 5C |s.\u.\w\x\y\z\{\|
10272 000000B0 7C 5C 7D 5C 7E 20 E2 82 - AC 64 20 EF BF BD 20 12 ||\}\~ ...d ... .|
10273 000000C0 33 20 78 20 53 20 53 34 - 0A |3 x S S4.|
10274 ---
10275 name: dollar-doublequoted-strings
10283 cat <<-$"aol"
10286 expected-stdout:
10290 ---
10291 name: dollar-quoted-strings
10295 print '#!'"$__progname"'\nfor x in "$@"; do print -r -- "$x"; done' >pfn
10297 ./pfn $'\ \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/ \1\2\3\4\5\6' \
10304 # integer-base-one-3As
10305 typeset -Uui16 -Z11 pos=0
10306 typeset -Uui16 -Z5 hv=2147483647
10307 typeset -i1 wc=0x0A
10310 while IFS= read -r line; do
10312 while [[ -n $line ]]; do
10315 (( pos )) && print -r -- "$dasc|"
10316 print -n "${pos#16#} "
10319 print -n "${hv#16#} "
10325 (( (pos++ & 15) == 7 )) && print -n -- '- '
10330 print -n ' '
10331 (( (pos++ & 15) == 7 )) && print -n -- '- '
10333 (( hv == 2147483647 )) || print -r -- "$dasc|"
10335 expected-stdout:
10336 00000000 20 21 22 23 24 25 26 27 - 28 29 2A 2B 2C 2D 2E 2F | !"#$%&'()*+,-./|
10337 00000010 20 01 02 03 04 05 06 0A - 61 0A 61 01 62 0A 07 38 | .......a.a.b..8|
10338 00000020 39 3A 3B 3C 3D 3E 3F 40 - 41 42 43 44 1B 46 47 48 |9:;<=>[email protected]|
10339 00000030 49 0A 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 01 56 57 |I.JKLMNOPQRST.VW|
10340 00000040 58 59 5A 5B 5C 5D 5E 5F - 60 07 08 64 1B 0A 0C 67 |XYZ[\]^_`..d...g|
10341 00000050 68 69 6A 6B 6C 6D 0A 6F - 70 71 0D 73 09 01 0B 77 |hijklm.opq.s...w|
10342 00000060 01 79 7A 7B 7C 7D 7E 20 - 24 78 0A E2 82 AC 64 0A |.yz{|}~ $x....d.|
10343 00000070 EF BF BD 0A C4 A3 0A 66 - 6E 0A 13 34 0A 9C 0A 9C |.......fn..4....|
10344 00000080 35 0A 01 0A 01 0A 7F 0A - 82 80 A6 0A 61 0A 62 0A |5...........a.b.|
10345 ---
10346 name: dollar-quotes-in-heredocs-strings
10364 unset nl; print -r -- "x${nl:=$'\n'}y"
10378 expected-stdout:
10395 ---
10396 name: dot-needs-argument
10400 "$__progname" -c .
10401 "$__progname" -c source
10402 expected-exit: e != 0
10403 expected-stderr-pattern:
10405 ---
10406 name: dot-errorlevel
10414 expected-stdout:
10416 ---
10417 name: alias-function-no-conflict
10428 unset -f foo
10446 expected-stdout:
10455 ---
10456 name: bash-function-parens
10466 print -r -- "${2:-foo}"
10468 mk 'function foo' >f-korn
10469 mk 'foo ()' >f-dash
10470 mk 'function foo ()' >f-bash
10471 print '#!'"$__progname"'\nprint -r -- "${0%/f-argh}"' >f-argh
10472 chmod +x f-*
10473 u=$(./f-argh)
10474 x="korn: $(./f-korn)"; echo "${x/@("$u")/.}"
10475 x="dash: $(./f-dash)"; echo "${x/@("$u")/.}"
10476 x="bash: $(./f-bash)"; echo "${x/@("$u")/.}"
10477 expected-stdout:
10479 dash: bar='./f-dash'
10480 bash: bar='./f-bash'
10481 ---
10482 name: integer-base-one-1
10486 set -U
10487 typeset -Uui16 i0=1#� i1=1#€
10488 typeset -i1 o0a=64
10489 typeset -i1 o1a=0x263A
10490 typeset -Uui1 o0b=0x7E
10491 typeset -Uui1 o1b=0xFDD0
10495 typeset -Uui1 i0 i1
10497 typeset -Uui16 tv1=1#~ tv2=1# tv3=1#� tv4=1#� tv5=1#� tv6=1#� tv7=1#  tv8=1#€
10499 typeset -i1 tv1 tv2 tv3 tv4 tv5 tv6 tv7 tv8
10501 typeset -i1 xs1=0xEF7F xs2=0xEF80 xs3=0xFDD0
10503 expected-stdout:
10510 ---
10511 name: integer-base-one-2a
10515 set -U
10518 expected-stderr-pattern:
10520 expected-exit: e != 0
10521 ---
10522 name: integer-base-one-2b
10526 set -U
10529 expected-stderr-pattern:
10531 expected-exit: e != 0
10532 ---
10533 name: integer-base-one-2c1
10537 set -U
10540 expected-stdout:
10542 ---
10543 name: integer-base-one-2c2
10550 expected-stderr-pattern:
10552 expected-exit: e != 0
10553 ---
10554 name: integer-base-one-2d1
10558 set -U
10559 typeset -i16 x=1#�
10560 echo /$x/ # invalid utf-8
10561 expected-stdout:
10563 ---
10564 name: integer-base-one-2d2
10568 set -U
10569 typeset -i16 x=1#�
10570 echo /$x/ # invalid 2-byte
10571 expected-stdout:
10573 ---
10574 name: integer-base-one-2d3
10578 set -U
10579 typeset -i16 x=1#�
10580 echo /$x/ # invalid 2-byte
10581 expected-stdout:
10583 ---
10584 name: integer-base-one-2d4
10588 set -U
10589 typeset -i16 x=1#��
10590 echo /$x/ # invalid 3-byte
10591 expected-stderr-pattern:
10593 expected-exit: e != 0
10594 ---
10595 name: integer-base-one-2d5
10599 set -U
10600 typeset -i16 x=1#��
10601 echo /$x/ # non-minimalistic
10602 expected-stderr-pattern:
10604 expected-exit: e != 0
10605 ---
10606 name: integer-base-one-2d6
10610 set -U
10611 typeset -i16 x=1#���
10612 echo /$x/ # non-minimalistic
10613 expected-stderr-pattern:
10615 expected-exit: e != 0
10616 ---
10617 name: integer-base-one-3As
10624 typeset -Uui16 i=0x100
10628 print -n "\x${i#16#1}"
10632 # integer-base-one-3As
10633 typeset -Uui16 -Z11 pos=0
10634 typeset -Uui16 -Z5 hv=2147483647
10635 typeset -i1 wc=0x0A
10638 while IFS= read -r line; do
10640 while [[ -n $line ]]; do
10643 (( pos )) && print -r -- "$dasc|"
10644 print -n "${pos#16#} "
10647 print -n "${hv#16#} "
10653 (( (pos++ & 15) == 7 )) && print -n -- '- '
10658 print -n ' '
10659 (( (pos++ & 15) == 7 )) && print -n -- '- '
10661 (( hv == 2147483647 )) || print -r -- "$dasc|"
10663 expected-stdout:
10664 00000000 48 65 6C 6C 6F 2C 20 57 - 6F 72 6C 64 21 5C 0A E3 |Hello, World!\..|
10665 00000010 81 93 E3 82 93 E3 81 AB - E3 81 A1 E3 81 AF EF BC |................|
10666 00000020 81 0A 01 02 03 04 05 06 - 07 08 09 0A 0B 0C 0D 0E |................|
10667 00000030 0F 10 11 12 13 14 15 16 - 17 18 19 1A 1B 1C 1D 1E |................|
10668 00000040 1F 20 21 22 23 24 25 26 - 27 28 29 2A 2B 2C 2D 2E |. !"#$%&'()*+,-.|
10669 00000050 2F 30 31 32 33 34 35 36 - 37 38 39 3A 3B 3C 3D 3E |/0123456789:;<=>|
10670 00000060 3F 40 41 42 43 44 45 46 - 47 48 49 4A 4B 4C 4D 4E |?@ABCDEFGHIJKLMN|
10671 00000070 4F 50 51 52 53 54 55 56 - 57 58 59 5A 5B 5C 5D 5E |OPQRSTUVWXYZ[\]^|
10672 00000080 5F 60 61 62 63 64 65 66 - 67 68 69 6A 6B 6C 6D 6E |_`abcdefghijklmn|
10673 00000090 6F 70 71 72 73 74 75 76 - 77 78 79 7A 7B 7C 7D 7E |opqrstuvwxyz{|}~|
10674 000000A0 7F 80 81 82 83 84 85 86 - 87 88 89 8A 8B 8C 8D 8E |................|
10675 000000B0 8F 90 91 92 93 94 95 96 - 97 98 99 9A 9B 9C 9D 9E |................|
10676 000000C0 9F A0 A1 A2 A3 A4 A5 A6 - A7 A8 A9 AA AB AC AD AE |................|
10677 000000D0 AF B0 B1 B2 B3 B4 B5 B6 - B7 B8 B9 BA BB BC BD BE |................|
10678 000000E0 BF C0 C1 C2 C3 C4 C5 C6 - C7 C8 C9 CA CB CC CD CE |................|
10679 000000F0 CF D0 D1 D2 D3 D4 D5 D6 - D7 D8 D9 DA DB DC DD DE |................|
10680 00000100 DF E0 E1 E2 E3 E4 E5 E6 - E7 E8 E9 EA EB EC ED EE |................|
10681 00000110 EF F0 F1 F2 F3 F4 F5 F6 - F7 F8 F9 FA FB FC FD FE |................|
10682 00000120 FF 7A 0A - |.z.|
10683 ---
10684 name: integer-base-one-3Ws
10686 some sample code for hexdumping UCS-2
10689 set -U
10692 typeset -Uui16 i=0x100
10696 print -n "\u${i#16#1}"
10699 print \\xff # invalid utf-8
10700 print \\xc2 # invalid 2-byte
10701 print \\xef\\xbf\\xc0 # invalid 3-byte
10702 print \\xc0\\x80 # non-minimalistic
10703 print \\xe0\\x80\\x80 # non-minimalistic
10707 # integer-base-one-3Ws
10708 typeset -Uui16 -Z11 pos=0
10709 typeset -Uui16 -Z7 hv
10710 typeset -i1 wc=0x0A
10711 typeset -i lpos
10714 while IFS= read -r line; do
10731 (( pos )) && print -r -- "$dasc|"
10732 print -n "${pos#16#} "
10736 print -n "${hv#16#} "
10738 print -n -- '- '
10743 print -n ' '
10744 (( (pos++ & 7) == 3 )) && print -n -- '- '
10746 (( hv == 2147483647 )) || print -r -- "$dasc|"
10748 expected-stdout:
10749 00000000 0048 0065 006C 006C - 006F 002C 0020 0057 |Hello, W|
10750 00000008 006F 0072 006C 0064 - 0021 005C 000A 3053 |orld!\.こ|
10751 00000010 3093 306B 3061 306F - FF01 000A 0001 0002 |んにちは!...|
10752 00000018 0003 0004 0005 0006 - 0007 0008 0009 000A |........|
10753 00000020 000B 000C 000D 000E - 000F 0010 0011 0012 |........|
10754 00000028 0013 0014 0015 0016 - 0017 0018 0019 001A |........|
10755 00000030 001B 001C 001D 001E - 001F 0020 0021 0022 |..... !"|
10756 00000038 0023 0024 0025 0026 - 0027 0028 0029 002A |#$%&'()*|
10757 00000040 002B 002C 002D 002E - 002F 0030 0031 0032 |+,-./012|
10758 00000048 0033 0034 0035 0036 - 0037 0038 0039 003A |3456789:|
10759 00000050 003B 003C 003D 003E - 003F 0040 0041 0042 |;<=>?@AB|
10760 00000058 0043 0044 0045 0046 - 0047 0048 0049 004A |CDEFGHIJ|
10761 00000060 004B 004C 004D 004E - 004F 0050 0051 0052 |KLMNOPQR|
10762 00000068 0053 0054 0055 0056 - 0057 0058 0059 005A |STUVWXYZ|
10763 00000070 005B 005C 005D 005E - 005F 0060 0061 0062 |[\]^_`ab|
10764 00000078 0063 0064 0065 0066 - 0067 0068 0069 006A |cdefghij|
10765 00000080 006B 006C 006D 006E - 006F 0070 0071 0072 |klmnopqr|
10766 00000088 0073 0074 0075 0076 - 0077 0078 0079 007A |stuvwxyz|
10767 00000090 007B 007C 007D 007E - 007F 0080 0081 0082 |{|}~....|
10768 00000098 0083 0084 0085 0086 - 0087 0088 0089 008A |........|
10769 000000A0 008B 008C 008D 008E - 008F 0090 0091 0092 |........|
10770 000000A8 0093 0094 0095 0096 - 0097 0098 0099 009A |........|
10771 000000B0 009B 009C 009D 009E - 009F 00A0 00A1 00A2 |..... ¡¢|
10772 000000B8 00A3 00A4 00A5 00A6 - 00A7 00A8 00A9 00AA |£¤¥¦§¨©ª|
10773 000000C0 00AB 00AC 00AD 00AE - 00AF 00B0 00B1 00B2 |«¬­®¯°±²|
10774 000000C8 00B3 00B4 00B5 00B6 - 00B7 00B8 00B9 00BA |³´µ¶·¸¹º|
10775 000000D0 00BB 00BC 00BD 00BE - 00BF 00C0 00C1 00C2 |»¼½¾¿ÀÁÂ|
10776 000000D8 00C3 00C4 00C5 00C6 - 00C7 00C8 00C9 00CA |ÃÄÅÆÇÈÉÊ|
10777 000000E0 00CB 00CC 00CD 00CE - 00CF 00D0 00D1 00D2 |ËÌÍÎÏÐÑÒ|
10778 000000E8 00D3 00D4 00D5 00D6 - 00D7 00D8 00D9 00DA |ÓÔÕÖרÙÚ|
10779 000000F0 00DB 00DC 00DD 00DE - 00DF 00E0 00E1 00E2 |ÛÜÝÞßàáâ|
10780 000000F8 00E3 00E4 00E5 00E6 - 00E7 00E8 00E9 00EA |ãäåæçèéê|
10781 00000100 00EB 00EC 00ED 00EE - 00EF 00F0 00F1 00F2 |ëìíîïðñò|
10782 00000108 00F3 00F4 00F5 00F6 - 00F7 00F8 00F9 00FA |óôõö÷øùú|
10783 00000110 00FB 00FC 00FD 00FE - 00FF 000A EFFF 000A |ûüýþÿ.�.|
10784 00000118 EFC2 000A EFEF EFBF - EFC0 000A EFC0 EF80 |�.���.��|
10785 00000120 000A EFE0 EF80 EF80 - 000A FFFD EFEF EFBF |.���.���|
10786 00000128 EFBE EFEF EFBF EFBF - 000A 007A 000A |����.z.|
10787 ---
10788 name: integer-base-one-3Ar
10794 typeset -Uui16 i=0x100
10798 print -n "\x${i#16#1}"
10802 # integer-base-one-3Ar
10803 typeset -Uui16 -Z11 pos=0
10804 typeset -Uui16 -Z5 hv=2147483647
10806 if read -arN -1 line; then
10807 typeset -i1 line
10812 (( pos )) && print -r -- "$dasc|"
10813 print -n "${pos#16#} "
10816 print -n "${hv#16#} "
10820 dasc=$dasc${line[i-1]#1#}
10822 (( (pos++ & 15) == 7 )) && print -n -- '- '
10826 print -n ' '
10827 (( (pos++ & 15) == 7 )) && print -n -- '- '
10829 (( hv == 2147483647 )) || print -r -- "$dasc|"
10831 expected-stdout:
10832 00000000 48 65 6C 6C 6F 2C 20 57 - 6F 72 6C 64 21 5C 0A E3 |Hello, World!\..|
10833 00000010 81 93 E3 82 93 E3 81 AB - E3 81 A1 E3 81 AF EF BC |................|
10834 00000020 81 0A 01 02 03 04 05 06 - 07 08 09 0A 0B 0C 0D 0E |................|
10835 00000030 0F 10 11 12 13 14 15 16 - 17 18 19 1A 1B 1C 1D 1E |................|
10836 00000040 1F 20 21 22 23 24 25 26 - 27 28 29 2A 2B 2C 2D 2E |. !"#$%&'()*+,-.|
10837 00000050 2F 30 31 32 33 34 35 36 - 37 38 39 3A 3B 3C 3D 3E |/0123456789:;<=>|
10838 00000060 3F 40 41 42 43 44 45 46 - 47 48 49 4A 4B 4C 4D 4E |?@ABCDEFGHIJKLMN|
10839 00000070 4F 50 51 52 53 54 55 56 - 57 58 59 5A 5B 5C 5D 5E |OPQRSTUVWXYZ[\]^|
10840 00000080 5F 60 61 62 63 64 65 66 - 67 68 69 6A 6B 6C 6D 6E |_`abcdefghijklmn|
10841 00000090 6F 70 71 72 73 74 75 76 - 77 78 79 7A 7B 7C 7D 7E |opqrstuvwxyz{|}~|
10842 000000A0 7F 80 81 82 83 84 85 86 - 87 88 89 8A 8B 8C 8D 8E |................|
10843 000000B0 8F 90 91 92 93 94 95 96 - 97 98 99 9A 9B 9C 9D 9E |................|
10844 000000C0 9F A0 A1 A2 A3 A4 A5 A6 - A7 A8 A9 AA AB AC AD AE |................|
10845 000000D0 AF B0 B1 B2 B3 B4 B5 B6 - B7 B8 B9 BA BB BC BD BE |................|
10846 000000E0 BF C0 C1 C2 C3 C4 C5 C6 - C7 C8 C9 CA CB CC CD CE |................|
10847 000000F0 CF D0 D1 D2 D3 D4 D5 D6 - D7 D8 D9 DA DB DC DD DE |................|
10848 00000100 DF E0 E1 E2 E3 E4 E5 E6 - E7 E8 E9 EA EB EC ED EE |................|
10849 00000110 EF F0 F1 F2 F3 F4 F5 F6 - F7 F8 F9 FA FB FC FD FE |................|
10850 00000120 FF 00 7A 0A - |..z.|
10851 ---
10852 name: integer-base-one-3Wr
10854 some sample code for hexdumping UCS-2; NUL and binary safe
10856 set -U
10859 typeset -Uui16 i=0x100
10863 print -n "\u${i#16#1}"
10866 print \\xff # invalid utf-8
10867 print \\xc2 # invalid 2-byte
10868 print \\xef\\xbf\\xc0 # invalid 3-byte
10869 print \\xc0\\x80 # non-minimalistic
10870 print \\xe0\\x80\\x80 # non-minimalistic
10874 # integer-base-one-3Wr
10875 typeset -Uui16 -Z11 pos=0
10876 typeset -Uui16 -Z7 hv=2147483647
10878 if read -arN -1 line; then
10879 typeset -i1 line
10889 dch=${line[i-1]#1#}
10895 (( pos )) && print -r -- "$dasc|"
10896 print -n "${pos#16#} "
10899 print -n "${hv#16#} "
10901 print -n -- '- '
10906 print -n ' '
10907 (( (pos++ & 7) == 3 )) && print -n -- '- '
10909 (( hv == 2147483647 )) || print -r -- "$dasc|"
10911 expected-stdout:
10912 00000000 0048 0065 006C 006C - 006F 002C 0020 0057 |Hello, W|
10913 00000008 006F 0072 006C 0064 - 0021 005C 000A 3053 |orld!\.こ|
10914 00000010 3093 306B 3061 306F - FF01 000A 0001 0002 |んにちは!...|
10915 00000018 0003 0004 0005 0006 - 0007 0008 0009 000A |........|
10916 00000020 000B 000C 000D 000E - 000F 0010 0011 0012 |........|
10917 00000028 0013 0014 0015 0016 - 0017 0018 0019 001A |........|
10918 00000030 001B 001C 001D 001E - 001F 0020 0021 0022 |..... !"|
10919 00000038 0023 0024 0025 0026 - 0027 0028 0029 002A |#$%&'()*|
10920 00000040 002B 002C 002D 002E - 002F 0030 0031 0032 |+,-./012|
10921 00000048 0033 0034 0035 0036 - 0037 0038 0039 003A |3456789:|
10922 00000050 003B 003C 003D 003E - 003F 0040 0041 0042 |;<=>?@AB|
10923 00000058 0043 0044 0045 0046 - 0047 0048 0049 004A |CDEFGHIJ|
10924 00000060 004B 004C 004D 004E - 004F 0050 0051 0052 |KLMNOPQR|
10925 00000068 0053 0054 0055 0056 - 0057 0058 0059 005A |STUVWXYZ|
10926 00000070 005B 005C 005D 005E - 005F 0060 0061 0062 |[\]^_`ab|
10927 00000078 0063 0064 0065 0066 - 0067 0068 0069 006A |cdefghij|
10928 00000080 006B 006C 006D 006E - 006F 0070 0071 0072 |klmnopqr|
10929 00000088 0073 0074 0075 0076 - 0077 0078 0079 007A |stuvwxyz|
10930 00000090 007B 007C 007D 007E - 007F 0080 0081 0082 |{|}~....|
10931 00000098 0083 0084 0085 0086 - 0087 0088 0089 008A |........|
10932 000000A0 008B 008C 008D 008E - 008F 0090 0091 0092 |........|
10933 000000A8 0093 0094 0095 0096 - 0097 0098 0099 009A |........|
10934 000000B0 009B 009C 009D 009E - 009F 00A0 00A1 00A2 |..... ¡¢|
10935 000000B8 00A3 00A4 00A5 00A6 - 00A7 00A8 00A9 00AA |£¤¥¦§¨©ª|
10936 000000C0 00AB 00AC 00AD 00AE - 00AF 00B0 00B1 00B2 |«¬­®¯°±²|
10937 000000C8 00B3 00B4 00B5 00B6 - 00B7 00B8 00B9 00BA |³´µ¶·¸¹º|
10938 000000D0 00BB 00BC 00BD 00BE - 00BF 00C0 00C1 00C2 |»¼½¾¿ÀÁÂ|
10939 000000D8 00C3 00C4 00C5 00C6 - 00C7 00C8 00C9 00CA |ÃÄÅÆÇÈÉÊ|
10940 000000E0 00CB 00CC 00CD 00CE - 00CF 00D0 00D1 00D2 |ËÌÍÎÏÐÑÒ|
10941 000000E8 00D3 00D4 00D5 00D6 - 00D7 00D8 00D9 00DA |ÓÔÕÖרÙÚ|
10942 000000F0 00DB 00DC 00DD 00DE - 00DF 00E0 00E1 00E2 |ÛÜÝÞßàáâ|
10943 000000F8 00E3 00E4 00E5 00E6 - 00E7 00E8 00E9 00EA |ãäåæçèéê|
10944 00000100 00EB 00EC 00ED 00EE - 00EF 00F0 00F1 00F2 |ëìíîïðñò|
10945 00000108 00F3 00F4 00F5 00F6 - 00F7 00F8 00F9 00FA |óôõö÷øùú|
10946 00000110 00FB 00FC 00FD 00FE - 00FF 000A EFFF 000A |ûüýþÿ.�.|
10947 00000118 EFC2 000A EFEF EFBF - EFC0 000A EFC0 EF80 |�.���.��|
10948 00000120 000A EFE0 EF80 EF80 - 000A FFFD EFEF EFBF |.���.���|
10949 00000128 EFBE EFEF EFBF EFBF - 000A 0000 007A 000A |����..z.|
10950 ---
10951 name: integer-base-one-4
10953 Check if ksh93-style base-one integers work
10956 set -U
10964 expected-stdout:
10966 2p 'aa': multi-character character constant
10971 ---
10972 name: integer-base-one-5A
10975 category: !shell:ebcdic-yes
10979 read -a y <x
10980 set -U
10981 typeset -Uui16 y
10983 expected-stdout:
10985 ---
10986 name: integer-base-one-5E
10989 category: !shell:ebcdic-no
10993 read -a y <x
10994 set -U
10995 typeset -Uui16 y
10997 expected-stdout:
10999 ---
11000 name: integer-base-one-5W
11004 set -U
11006 read -a y <x
11008 typeset -Uui16 y
11010 expected-stdout:
11012 ---
11013 name: ulimit-1
11017 ulimit -c 0
11018 ---
11019 name: ulimit-2
11022 XXX Haiku works, but only for -n and -V
11025 if ! x=$(ulimit -d) || [[ $x = unknown ]]; then
11029 ulimit -dS $x && echo okay
11031 expected-stdout:
11033 ---
11034 name: ulimit-3
11039 [[ -z $(set | grep ^opt) ]]; mis=$?
11044 ulimit -a >tmpf
11045 set -o noglob
11046 while IFS= read -r line; do
11048 if [[ -z $x || ${#x}/${%x} != 1/1 ]]; then
11049 print -r -- "weird line: $line"
11053 set -- $line
11055 if [[ -n $v ]]; then
11056 print -r -- "duplicate -$x \"$2\" already seen as \"$v\""
11068 expected-stdout:
11070 ---
11071 name: redir-1
11078 print -u2 e$((i++)).
11090 expected-stdout:
11100 ---
11101 name: bashiop-1
11103 Check if GNU bash-like I/O redirection works
11115 expected-stdout:
11120 ---
11121 name: bashiop-2a
11123 Check if GNU bash-like I/O redirection works
11135 expected-stdout:
11140 ---
11141 name: bashiop-2b
11143 Check if GNU bash-like I/O redirection works
11155 expected-stdout:
11160 ---
11161 name: bashiop-2c
11163 Check if GNU bash-like I/O redirection works
11167 set -o noclobber
11177 expected-stdout:
11183 ---
11184 name: bashiop-3a
11186 Check if GNU bash-like I/O redirection fails correctly
11190 set -o noclobber
11200 expected-stdout:
11203 expected-stderr-pattern: /.*: can't (create|overwrite) .*/
11204 ---
11205 name: bashiop-3b
11207 Check if GNU bash-like I/O redirection fails correctly
11211 set -o noclobber
11221 expected-stdout:
11226 ---
11227 name: bashiop-4
11229 Check if GNU bash-like I/O redirection works
11240 [[ -e bar ]] && threeout "$bf" &>foo
11243 echo -n >bar
11247 expected-stdout:
11252 ---
11253 name: bashiop-5
11255 Check if GNU bash-like I/O redirection is only supported
11258 :>x; echo 1 "$("$__progname" -c 'echo foo>/dev/null&>x echo bar')" = "$(<x)" .
11259 :>x; echo 2 "$("$__progname" -o posix -c 'echo foo>/dev/null&>x echo bar')" = "$(<x)" .
11260 :>x; echo 3 "$("$__progname" -o sh -c 'echo foo>/dev/null&>x echo bar')" = "$(<x)" .
11261 expected-stdout:
11265 ---
11266 name: oksh-eval
11279 expected-stdout:
11284 ---
11285 name: oksh-and-list-error-1
11287 Test exit status of rightmost element in 2 element && list in -e mode
11291 arguments: !-e!
11292 expected-exit: e != 0
11293 ---
11294 name: oksh-and-list-error-2
11296 Test exit status of rightmost element in 3 element && list in -e mode
11300 arguments: !-e!
11301 expected-exit: e != 0
11302 ---
11303 name: oksh-or-list-error-1
11305 Test exit status of || list in -e mode
11309 arguments: !-e!
11310 expected-exit: e != 0
11311 ---
11312 name: oksh-longline-crash
11316 ulimit -c 0
11317-lz -lpng /usr/local/lib/libjpeg.la -ltiff -lm -lX11 -lXext /usr/local/lib/libiconv.la -L/usr/loca…
11318-lgnomeui -lart_lgpl -lgdk_imlib -ltiff -ljpeg -lungif -lpng -lz -lSM -lICE -lgtk -lgdk -lgmodule
11321 -L*)
11332 ---
11333 name: oksh-seterror-1
11335 The -e flag should be ignored when executing a compound list
11340 arguments: !-e!
11341 expected-exit: e == 0
11342 ---
11343 name: oksh-seterror-2
11345 The -e flag should be ignored when executing a compound list
11350 arguments: !-e!
11351 expected-exit: e == 0
11352 ---
11353 name: oksh-seterror-3
11355 The -e flag should be ignored when executing a compound list
11359 arguments: !-e!
11360 expected-exit: e == 0
11361 ---
11362 name: oksh-seterror-4
11364 The -e flag should be ignored when executing a pipeline
11372 arguments: !-e!
11373 expected-exit: e == 0
11374 ---
11375 name: oksh-seterror-5
11377 The -e flag should be ignored when executing a pipeline
11382 arguments: !-e!
11383 expected-exit: e == 0
11384 ---
11385 name: oksh-seterror-6
11387 When trapping ERR and EXIT, both traps should run in -e mode
11392 set -e
11396 arguments: !-e!
11397 expected-exit: e != 0
11398 expected-stdout:
11401 ---
11402 name: oksh-seterror-7
11404 The -e flag within a command substitution should be honored
11406 echo $( set -e; false; echo foo )
11407 arguments: !-e!
11408 expected-stdout:
11410 ---
11411 name: oksh-input-comsub
11416 var=$(< non-existent)
11417 expected-exit: e != 0
11418 expected-stderr-pattern: /non-existent/
11419 ---
11420 name: oksh-empty-for-list
11425 ---
11426 name: oksh-varfunction-mod1
11431 env. If f is a Bourne style function, (new) also not. Furthermore,
11437 print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
11438 'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
11439 done >env; chmod +x env; PATH=.$PATHSEP$PATH
11445 x=$(env | grep FOO)
11458 x=$(env | grep FOO)
11495 ---
11496 name: fd-cloexec-1
11501 cat >cld <<-EOF
11509 expected-exit: e != 0
11510 expected-stderr-pattern:
11512 ---
11513 name: fd-cloexec-2
11518 cat >cld <<-EOF
11524 test -n "$POSH_VERSION" || set -o posix
11527 expected-stdout:
11529 ---
11530 name: fd-cloexec-3
11532 Another check for close-on-exec
11537 read -rN-1 -u$1 s 2>/dev/null; e=$?
11538 print -r -- "($1, $((!e)), $s)"
11544 print -r -- $("$__progname" "$@" -c "$s") "$@" .
11547 runtest 'exec 3<tx; ./ts 3 3<&3; ./ts 3' -o posix
11548 runtest 'exec 3<tx; ./ts 3 3<&3; ./ts 3' -o sh
11551 expected-stdout:
11553 (3, 1, foo) (3, 1, ) -o posix .
11554 (3, 1, foo) (3, 1, ) -o sh .
11557 ---
11558 name: comsub-1a
11561 see also regression-6: matching parenthesēs bug
11567 TEST=1234; echo 3 ${TEST: $(case 1 in (1) echo 1;; (*) echo 2;; esac)} .
11568 TEST=5678; echo 4 ${TEST: $(case 1 in 1) echo 1;; *) echo 2;; esac)} .
11571 expected-stdout:
11578 ---
11579 name: comsub-1b
11591 expected-stdout:
11598 ---
11599 name: comsub-2
11605 ① bash[34] seem to choke on comment ending with backslash-newline
11613 expected-stdout:
11615 ---
11616 name: comsub-3
11618 Extended test for COMSUB explaining why a recursive parser
11619 is a must (a non-recursive parser cannot pass all three of
11620 these test cases, especially the ‘#’ is difficult)
11623 echo $(typeset -i10 x=16#20; echo $x)
11624 echo $(typeset -Uui16 x=16#$(id -u)
11627 typeset -Uui16 a=36#foo; c=2
11628 typeset -Uui16 b=36 #foo; d=2
11630 expected-stdout:
11634 ---
11635 name: comsub-4
11641 typeset -f x
11642 expected-stdout:
11653 ---
11654 name: comsub-5
11659 print '#!'"$__progname"'\nfor x in "$@"; do print -r -- "$x"; done' >pfn
11667 typeset -f foo >x
11671 typeset -f foo
11673 expected-stdout:
11687 ---
11688 name: comsub-torture
11692 if [[ -z $__progname ]]; then echo >&2 call me with __progname; exit 1; fi
11693 while IFS= read -r line; do
11706 print -nr -- "$x"
11707 print -r -- "${x}typeset -f inline_$nextf" | "$__progname"
11709 print -nr -- "$x"
11710 print -r -- "${x}typeset -f comsub_$nextf" | "$__progname"
11712 print -nr -- "$x"
11713 print -r -- "${x}typeset -f reread_$nextf" | "$__progname"
11723 (echo $foo | tr -dc 0-9; echo)
11737 i=10; until (( !--i )) ; do echo $i; done
11750 cat 1>bar <<-EOFI
11772 x=$(sysctl -n kern.version | sed 1q)
11773 [[ -s /etc/motd && "$([[ "$(head -1 /etc/motd)" != $x ]] && \
11774 ed -s /etc/motd 2>&1 <<-EOF
11781 EOF)" = @(?) ]] && rm -f /etc/motd
11782 if [[ ! -s /etc/motd ]]; then
11783 install -c -o root -g wheel -m 664 /dev/null /etc/motd
11784 print -- "$x\n" >/etc/motd
11792 expected-stdout:
11812 (echo $foo | tr -dc 0-9; echo)
11815 ( \echo $foo | \tr -dc 0-9
11819 (echo $foo | tr -dc 0-9; echo)
11822 x=$( ( \echo $foo | \tr -dc 0-9 ; \echo ) )
11825 (echo $foo | tr -dc 0-9; echo)
11828 x=$( ( ( \echo $foo | \tr -dc 0-9 ; \echo ) ) | \tr u x )
11971 i=10; until (( !--i )) ; do echo $i; done
11976 \\builtin let " !--i "
11983 i=10; until (( !--i )) ; do echo $i; done
11986 x=$(i=10 ; until { \\builtin let " !--i " ; } ; do \echo $i ; done )
11989 i=10; until (( !--i )) ; do echo $i; done
11992 x=$( ( i=10 ; until { \\builtin let " !--i " ; } ; do \echo $i ; done ) | \tr u x )
12092 cat 1>bar <<-EOFI
12097 \cat >bar <<-EOFI
12103 cat 1>bar <<-EOFI
12108 x=$(\cat >bar <<-EOFI
12114 cat 1>bar <<-EOFI
12119 x=$( ( \cat >bar <<-EOFI ) | \tr u x
12273 x=$(sysctl -n kern.version | sed 1q)
12274 [[ -s /etc/motd && "$([[ "$(head -1 /etc/motd)" != $x ]] && \
12275 ed -s /etc/motd 2>&1 <<-EOF
12282 EOF)" = @(?) ]] && rm -f /etc/motd
12283 if [[ ! -s /etc/motd ]]; then
12284 install -c -o root -g wheel -m 664 /dev/null /etc/motd
12285 print -- "$x\n" >/etc/motd
12289 x=$(\sysctl -n kern.version | \sed 1q )
12290 [[ -s /etc/motd && "$([[ "$(\head -1 /etc/motd )" != $x ]] && \ed -s /etc/motd 2>&1 <<-EOF
12298 )" = @(?) ]] && \rm -f /etc/motd
12299 if [[ ! -s /etc/motd ]]
12301 \install -c -o root -g wheel -m 664 /dev/null /etc/motd
12302 \print -- "$x\n" >/etc/motd
12306 x=$(sysctl -n kern.version | sed 1q)
12307 [[ -s /etc/motd && "$([[ "$(head -1 /etc/motd)" != $x ]] && \
12308 ed -s /etc/motd 2>&1 <<-EOF
12315 EOF)" = @(?) ]] && rm -f /etc/motd
12316 if [[ ! -s /etc/motd ]]; then
12317 install -c -o root -g wheel -m 664 /dev/null /etc/motd
12318 print -- "$x\n" >/etc/motd
12322 …x=$(x=$(\sysctl -n kern.version | \sed 1q ) ; [[ -s /etc/motd && "$([[ "$(\head -1 /etc/motd )" !=…
12330 …)" = @(?) ]] && \rm -f /etc/motd ; if [[ ! -s /etc/motd ]] ; then \install -c -o root -g wheel -m …
12333 x=$(sysctl -n kern.version | sed 1q)
12334 [[ -s /etc/motd && "$([[ "$(head -1 /etc/motd)" != $x ]] && \
12335 ed -s /etc/motd 2>&1 <<-EOF
12342 EOF)" = @(?) ]] && rm -f /etc/motd
12343 if [[ ! -s /etc/motd ]]; then
12344 install -c -o root -g wheel -m 664 /dev/null /etc/motd
12345 print -- "$x\n" >/etc/motd
12349 …=$( ( x=$(\sysctl -n kern.version | \sed 1q ) ; [[ -s /etc/motd && "$([[ "$(\head -1 /etc/motd )" …
12357 …)" = @(?) ]] && \rm -f /etc/motd ; if [[ ! -s /etc/motd ]] ; then \install -c -o root -g wheel -m …
12368 \\builtin set -A c+ -- d e
12378 x=$(case x in (x) a+=b ; \\builtin set -A c+ -- d e ;; esac )
12386 x=$( ( case x in (x) a+=b ; \\builtin set -A c+ -- d e ;; esac ) | \tr u x )
12388 ---
12389 name: comsub-torture-io
12393 if [[ -z $__progname ]]; then echo >&2 call me with __progname; exit 1; fi
12394 while IFS= read -r line; do
12407 print -nr -- "$x"
12408 print -r -- "${x}typeset -f inline_$nextf" | "$__progname"
12410 print -nr -- "$x"
12411 print -r -- "${x}typeset -f comsub_$nextf" | "$__progname"
12413 print -nr -- "$x"
12414 print -r -- "${x}typeset -f reread_$nextf" | "$__progname"
12424 (echo $foo | tr -dc 0-9 >&3; echo >&3) >&3
12438 i=10; until (( !--i )) >&3 ; do echo $i; done >&3
12448 expected-stdout:
12468 (echo $foo | tr -dc 0-9 >&3; echo >&3) >&3
12471 ( \echo $foo | \tr -dc 0-9 >&3
12475 (echo $foo | tr -dc 0-9 >&3; echo >&3) >&3
12478 x=$( ( \echo $foo | \tr -dc 0-9 >&3 ; \echo >&3 ) >&3 )
12481 (echo $foo | tr -dc 0-9 >&3; echo >&3) >&3
12484 x=$( ( ( \echo $foo | \tr -dc 0-9 >&3 ; \echo >&3 ) >&3 ) | \tr u x )
12627 i=10; until (( !--i )) >&3 ; do echo $i; done >&3
12632 \\builtin let " !--i "
12639 i=10; until (( !--i )) >&3 ; do echo $i; done >&3
12642 x=$(i=10 ; until { \\builtin let " !--i " ; } >&3 ; do \echo $i ; done >&3 )
12645 i=10; until (( !--i )) >&3 ; do echo $i; done >&3
12648 x=$( ( i=10 ; until { \\builtin let " !--i " ; } >&3 ; do \echo $i ; done >&3 ) | \tr u x )
12714 ---
12715 name: funsub-1
12717 Check that non-subenvironment command substitution works
12719 set -e
12729 expected-stdout:
12734 ---
12735 name: funsub-2
12743 expected-stdout:
12747 ---
12748 name: valsub-1
12769 typeset -p t
12770 echo -n this used to segfault
12772 expected-stdout:
12779 ---
12780 name: event-subst-3
12783 file-setup: file 755 "falsetto"
12787 file-setup: file 755 "!false"
12800 expected-stdout:
12807 ---
12808 name: event-subst-0
12811 need-ctty: yes
12812 arguments: !-i!
12813 file-setup: file 755 "falsetto"
12817 file-setup: file 755 "!false"
12830 expected-stdout:
12837 expected-stderr-pattern:
12839 ---
12840 name: nounset-1
12842 Check that "set -u" matches (future) SUSv4 requirement
12844 (set -u
12848 if [[ -n $v ]]; then
12877 (echo $-)
12885 ) 2>&1 | sed -e 's/^[A-Za-z]://' -e 's/^[^]]*]//' -e 's/^[^:]*: *//'
12887 expected-stdout:
12916 ---
12917 name: nameref-1
12922 typeset -n ir2=bar
12923 typeset -n ind=ir2
12931 typeset -n ir2=ind
12935 typeset|grep ' ir2'|sed -e 's/^/s2: /' -e 's/nameref/typeset -n/'
12936 set -A blub -- e1 e2 e3
12937 typeset -n ind=blub
12938 typeset -n ir2=blub[2]
12943 expected-stdout:
12953 s2: typeset -n ir2
12958 ---
12959 name: nameref-2da
12966 typeset -n v=bar
12982 expected-stdout:
12994 ---
12995 name: nameref-3
12999 typeset -n foo=bar[i]
13000 set -A bar -- b c a
13004 expected-stdout:
13009 ---
13010 name: nameref-4
13013 time-limit: 3
13016 typeset -n foo=fnord fnord=foo
13019 set -A foo bad
13023 expected-stdout:
13026 expected-stderr-pattern:
13028 ---
13029 name: better-parens-1a
13038 expected-stdout:
13041 ---
13042 name: better-parens-1b
13047 expected-stdout:
13049 ---
13050 name: better-parens-1c
13055 expected-stdout:
13057 ---
13058 name: better-parens-2a
13067 expected-stdout:
13070 ---
13071 name: better-parens-2b
13076 expected-stdout:
13078 ---
13079 name: better-parens-2c
13084 expected-stdout:
13086 ---
13087 name: better-parens-3a
13096 expected-stdout:
13099 ---
13100 name: better-parens-3b
13105 expected-stdout:
13107 ---
13108 name: better-parens-3c
13113 expected-stdout:
13115 ---
13116 name: better-parens-4a
13125 expected-stdout:
13128 ---
13129 name: better-parens-4b
13134 expected-stdout:
13136 ---
13137 name: better-parens-4c
13142 expected-stdout:
13144 ---
13145 name: better-parens-5
13151 expected-stdout:
13154 ---
13155 name: echo-test-1
13157 Test what the echo builtin does (mksh)
13158 category: !shell:ebcdic-yes
13160 echo -n 'foo\x40bar'
13161 echo -e '\tbaz'
13162 expected-stdout:
13164 ---
13165 name: echo-test-1-ebcdic
13167 Test what the echo builtin does (mksh)
13168 category: !shell:ebcdic-no
13170 echo -n 'foo\x7Cbar'
13171 echo -e '\tbaz'
13172 expected-stdout:
13174 ---
13175 name: echo-test-2
13177 Test what the echo builtin does (POSIX)
13179 that -n shall be treated as an option, not XSI which
13183 test -n "$POSH_VERSION" || set -o posix
13184 echo -n 'foo\x40bar'
13185 echo -e '\tbaz'
13186 expected-stdout:
13187 foo\x40bar-e \tbaz
13188 ---
13189 name: echo-test-3-mnbsd
13191 Test what the echo builtin does, and test a compatibility flag.
13194 "$__progname" -c 'echo -n 1=\\x40$1; echo -e \\x2E' -- foo bar
13195 "$__progname" -o posix -c 'echo -n 2=\\x40$1; echo -e \\x2E' -- foo bar
13196 "$__progname" -o sh -c 'echo -n 3=\\x40$1; echo -e \\x2E' -- foo bar
13197 expected-stdout:
13199 2=\x40foo-e \x2E
13201 ---
13202 name: echo-test-3-normal
13204 Test what the echo builtin does, and test a compatibility flag.
13205 category: !mnbsdash,!shell:ebcdic-yes
13207 "$__progname" -c 'echo -n 1=\\x40$1; echo -e \\x2E' -- foo bar
13208 "$__progname" -o posix -c 'echo -n 2=\\x40$1; echo -e \\x2E' -- foo bar
13209 "$__progname" -o sh -c 'echo -n 3=\\x40$1; echo -e \\x2E' -- foo bar
13210 expected-stdout:
13212 2=\x40foo-e \x2E
13213 3=\x40foo-e \x2E
13214 ---
13215 name: echo-test-3-ebcdic
13217 Test what the echo builtin does, and test a compatibility flag.
13218 category: !mnbsdash,!shell:ebcdic-no
13220 "$__progname" -c 'echo -n 1=\\x7C$1; echo -e \\x4B' -- foo bar
13221 "$__progname" -o posix -c 'echo -n 2=\\x7C$1; echo -e \\x4B' -- foo bar
13222 "$__progname" -o sh -c 'echo -n 3=\\x7C$1; echo -e \\x4B' -- foo bar
13223 expected-stdout:
13225 2=\x7Cfoo-e \x4B
13226 3=\x7Cfoo-e \x4B
13227 ---
13228 name: utilities-getopts-1
13232 set -- -a -a -x
13237 expected-stdout:
13242 ---
13243 name: utilities-getopts-2
13247 set -- -a Mary -x
13252 expected-stdout:
13256 expected-stderr-pattern: /.*-x.*option/
13257 ---
13258 name: utilities-getopts-3
13262 set -- -x arg -y
13263 getopts x:y opt && echo "${OPTARG-unset}"
13264 getopts x:y opt && echo "${OPTARG-unset}"
13265 expected-stdout:
13268 ---
13269 name: wcswidth-1
13276 print 8-bit width: ${%s} .
13277 set -U
13283 print 8-bit width: ${%s} .
13284 set -U
13287 expected-stdout:
13289 8-bit width: -1 .
13293 8-bit width: 3 .
13296 ---
13297 name: wcswidth-2
13302 set -U
13308 expected-stdout:
13310 c -1 .
13311 d -1 .
13312 ---
13313 name: wcswidth-3
13318 expected-stderr-pattern:
13320 expected-exit: 1
13321 ---
13322 name: wcswidth-4a
13327 expected-stderr-pattern:
13329 expected-exit: 1
13330 ---
13331 name: wcswidth-4b
13336 expected-stderr-pattern:
13338 expected-exit: 1
13339 ---
13340 name: wcswidth-4c
13346 expected-stdout:
13348 ---
13349 name: realpath-1
13358 ln -s dir lndir
13359 ln -s file lnfile
13360 ln -s nix lnnix
13361 ln -s . lnself
13394 expected-stdout:
13420 ---
13421 name: realpath-2
13427 ln -s /bin t1
13428 ln -s //bin t2
13429 ln -s ///bin t3
13439 rm -f t1 t2 t3
13445 expected-stdout:
13458 ---
13459 name: crash-1
13465 "$__progname" -c 'x=$(tr z r <<<baz); echo $x'
13466 expected-stdout:
13468 ---
13469 name: debian-117-1
13471 Check test - bug#465250
13473 test \( ! -e \) ; echo $?
13474 expected-stdout:
13476 ---
13477 name: debian-117-2
13479 Check test - bug#465250
13481 test \( -e \) ; echo $?
13482 expected-stdout:
13484 ---
13485 name: debian-117-3
13487 Check test - bug#465250
13489 test ! -e ; echo $?
13490 expected-stdout:
13492 ---
13493 name: debian-117-4
13495 Check test - bug#465250
13497 test -e ; echo $?
13498 expected-stdout:
13500 ---
13501 name: case-zsh
13525 expected-stdout:
13534 ---
13535 name: case-braces
13541 print -n "$((++i))($value)bourne "
13546 print -n "$((++i))($value)korn "
13552 expected-stdout:
13559 ---
13560 name: command-shift
13579 expected-stdout:
13587 ---
13588 name: command-set
13592 showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
13594 set -- foo bar baz
13596 command set -- miau 'meow nyao'
13598 expected-stdout:
13602 ---
13603 name: command-readonly
13608 "$__progname" -c 'readonly v; export v=foo || echo ok'
13610 "$__progname" -c 'readonly v; command export v=foo || echo ok'
13612 "$__progname" -c 'readonly v; readonly v=foo || echo ok'
13614 "$__progname" -c 'readonly v; command readonly v=foo || echo ok'
13616 expected-stdout:
13623 ---
13624 name: command-dot-regression
13628 cat >test.mksh <<\EOF
13629 set -- one two
13631 for s_arg in "$#" "$@"; do echo -n "<$s_arg> "; done; echo .
13633 "$__progname" -c '. ./test.mksh' dummy oh dear this is not good
13635 "$__progname" -c 'command . ./test.mksh' dummy oh dear this is not good
13636 expected-stdout:
13640 ---
13641 name: command-pvV-posix-priorities
13643 For POSIX compatibility, command -v should find aliases and reserved
13644 words, and command -p[vV] should find aliases, reserved words, and
13657 command -v "$word"
13658 command -pv "$word"
13659 command -V "$word"
13660 command -pV "$word"
13666 case $(command -v miau) {
13668 (!(/*|[A-Z]:/*)) echo fail2 ;;
13670 (/*|[A-Z]:/*) echo pwd bad? ;;
13673 expected-stdout:
13701 ---
13702 name: whence-preserve-tradition
13704 This regression test is to ensure that the POSIX compatibility
13705 changes for 'command' (see previous test) do not affect traditional
13714 whence -p "$word"
13715 whence -v "$word"
13716 whence -pv "$word"
13718 expected-stdout:
13735 ---
13736 name: duffs-device
13738 Check that the compiler did not optimise-break them
13740 category: !shell:faux-ebcdic,!shell:ebcdic-yes
13744 typeset -i1 i=0
13749 typeset -p s
13750 expected-stdout:
13751 …20\021\022\023\024\025\026\027\030\031\032\E\034\035\036\037 !"#$%&\047()*+,-./0123456789:;<=>?@AB…
13752 ---
13753 name: duffs-device-ebcdic
13755 Check that the compiler did not optimise-break them
13756 category: !shell:ebcdic-no
13760 typeset -i1 i=0
13765 typeset -p s
13766 expected-stdout:
13767 …4\065\066\067\070\071\072\073\074\075\076\077 ���������.<(+|&���������!$*);^-/�������Ѧ,%_>?�������…
13768 ---
13769 name: duffs-device-faux-EBCDIC
13771 Check that the compiler did not optimise-break them
13772 category: shell:faux-ebcdic
13776 typeset -i1 i=0
13781 typeset -p s
13782 expected-stdout:
13783 …20\021\022\023\024\025\026\027\030\031\032\E\034\035\036\037 !"#$%&\047()*+,-./0123456789:;<=>?@AB…
13784 ---
13785 name: stateptr-underflow
13791 [[ -o utf8-mode ]]; local u=$?
13794 [[ -n $s ]] || { s=$(cat;print x); s=${s%x}; }
13795 local -i i=0 n=${#s} p=0 v x
13796 local -i16 o
13802 ([A-Z]) (( v = 1#$c - 65 )) ;;
13803 ([a-z]) (( v = 1#$c - 71 )) ;;
13804 ([0-9]) (( v = 1#$c + 4 )) ;;
13820 print -n $t
13821 (( u )) || set -U
13824 i=-1
13830 ---
13831 name: xtrace-1
13833 Check that "set -x" doesn't redirect too quickly
13837 echo 'GNU bash, version 2.05b.0(1)-release (i386-ecce-mirbsd10)
13841 "$__progname" -xc 'foo=$(./bash --version 2>&1 | sed q); echo "=$foo="'
13842 expected-stdout:
13843 =GNU bash, version 2.05b.0(1)-release (i386-ecce-mirbsd10)=
13844 expected-stderr-pattern:
13846 ---
13847 name: xtrace-2
13849 Check that "set -x" is off during PS4 expansion
13852 print -n "(f1:$-)"
13853 set -x
13854 print -n "(f2:$-)"
13856 PS4='[(p:$-)$(f)] '
13857 print "(o0:$-)"
13858 set -x -o inherit-xtrace
13859 print "(o1:$-)"
13861 print "(o2:$-)"
13862 expected-stdout:
13866 expected-stderr:
13869 ---
13870 name: fksh-flags
13873 category: shell:legacy-no
13878 set -e
13879 echo 2 "${-/s}" .
13881 set -fh
13882 echo 1 "${-/s}" .
13884 echo 3 "${-/s}" .
13885 expected-stdout:
13889 ---
13890 name: fksh-flags-legacy
13893 category: shell:legacy-yes
13898 set -e
13899 echo 2 "${-/s}" .
13901 set -fh
13902 echo 1 "${-/s}" .
13904 echo 3 "${-/s}" .
13905 expected-stdout:
13909 ---
13910 name: fsh-flags
13917 set -e
13918 echo 2 "${-/s}" .
13920 set -fh
13921 echo 1 "${-/s}" .
13923 echo 3 "${-/s}" .
13924 expected-stdout:
13928 ---