003 File Manager
Current Path:
/usr/src/bin/sh/tests/expansion
usr
/
src
/
bin
/
sh
/
tests
/
expansion
/
📁
..
📄
Makefile
(2.97 KB)
📄
Makefile.depend
(176 B)
📄
arith1.0
(431 B)
📄
arith10.0
(595 B)
📄
arith11.0
(379 B)
📄
arith12.0
(63 B)
📄
arith13.0
(269 B)
📄
arith14.0
(756 B)
📄
arith15.0
(392 B)
📄
arith16.0
(496 B)
📄
arith17.0
(48 B)
📄
arith2.0
(1.31 KB)
📄
arith3.0
(191 B)
📄
arith4.0
(372 B)
📄
arith5.0
(299 B)
📄
arith6.0
(393 B)
📄
arith7.0
(114 B)
📄
arith8.0
(82 B)
📄
arith9.0
(345 B)
📄
assign1.0
(1017 B)
📄
cmdsubst1.0
(1.03 KB)
📄
cmdsubst10.0
(869 B)
📄
cmdsubst11.0
(106 B)
📄
cmdsubst12.0
(73 B)
📄
cmdsubst13.0
(235 B)
📄
cmdsubst14.0
(27 B)
📄
cmdsubst15.0
(28 B)
📄
cmdsubst16.0
(51 B)
📄
cmdsubst17.0
(54 B)
📄
cmdsubst18.0
(109 B)
📄
cmdsubst19.0
(118 B)
📄
cmdsubst2.0
(1.26 KB)
📄
cmdsubst20.0
(113 B)
📄
cmdsubst21.0
(116 B)
📄
cmdsubst22.0
(110 B)
📄
cmdsubst23.0
(91 B)
📄
cmdsubst24.0
(653 B)
📄
cmdsubst25.0
(64 B)
📄
cmdsubst26.0
(56 B)
📄
cmdsubst3.0
(440 B)
📄
cmdsubst4.0
(63 B)
📄
cmdsubst5.0
(53 B)
📄
cmdsubst6.0
(890 B)
📄
cmdsubst7.0
(443 B)
📄
cmdsubst8.0
(255 B)
📄
cmdsubst9.0
(96 B)
📄
export1.0
(209 B)
📄
export2.0
(282 B)
📄
export3.0
(408 B)
📄
heredoc1.0
(349 B)
📄
heredoc2.0
(200 B)
📄
ifs1.0
(539 B)
📄
ifs2.0
(577 B)
📄
ifs3.0
(437 B)
📄
ifs4.0
(681 B)
📄
ifs5.0
(49 B)
📄
ifs6.0
(67 B)
📄
ifs7.0
(64 B)
📄
length1.0
(312 B)
📄
length2.0
(62 B)
📄
length3.0
(271 B)
📄
length4.0
(324 B)
📄
length5.0
(537 B)
📄
length6.0
(155 B)
📄
length7.0
(246 B)
📄
length8.0
(250 B)
📄
local1.0
(321 B)
📄
local2.0
(450 B)
📄
pathname1.0
(1.79 KB)
📄
pathname2.0
(891 B)
📄
pathname3.0
(543 B)
📄
pathname4.0
(415 B)
📄
pathname5.0
(40 B)
📄
pathname6.0
(433 B)
📄
plus-minus1.0
(2.31 KB)
📄
plus-minus2.0
(38 B)
📄
plus-minus3.0
(1.28 KB)
📄
plus-minus4.0
(962 B)
📄
plus-minus5.0
(623 B)
📄
plus-minus6.0
(743 B)
📄
plus-minus7.0
(384 B)
📄
plus-minus8.0
(136 B)
📄
plus-minus9.0
(48 B)
📄
question1.0
(832 B)
📄
question2.0
(176 B)
📄
readonly1.0
(128 B)
📄
redir1.0
(481 B)
📄
set-u1.0
(1.26 KB)
📄
set-u2.0
(133 B)
📄
set-u3.0
(96 B)
📄
tilde1.0
(903 B)
📄
tilde2.0
(1.71 KB)
📄
trim1.0
(2.49 KB)
📄
trim10.0
(42 B)
📄
trim11.0
(44 B)
📄
trim2.0
(1.48 KB)
📄
trim3.0
(1.1 KB)
📄
trim4.0
(463 B)
📄
trim5.0
(508 B)
📄
trim6.0
(520 B)
📄
trim7.0
(551 B)
📄
trim8.0
(2.15 KB)
📄
trim9.0
(2 KB)
Editing: trim8.0
# $FreeBSD$ unset LC_ALL LC_CTYPE=en_US.UTF-8 export LC_CTYPE c1=e # a umlaut c2=$(printf '\303\244') # euro sign c3=$(printf '\342\202\254') # some sort of 't' outside BMP c4=$(printf '\360\235\225\245') s=$c1$c2$c3$c4 testcase() { code="$1" expected="$2" oIFS="$IFS" eval "$code" IFS='|' result="$#|$*" IFS="$oIFS" if [ "x$result" = "x$expected" ]; then ok=x$ok else failures=x$failures echo "For $code, expected $expected actual $result" fi } testcase 'set -- "$s"' "1|$s" testcase 'set -- "${s#$c2}"' "1|$s" testcase 'set -- "${s#*}"' "1|$s" testcase 'set -- "${s#$c1}"' "1|$c2$c3$c4" testcase 'set -- "${s#$c1$c2}"' "1|$c3$c4" testcase 'set -- "${s#$c1$c2$c3}"' "1|$c4" testcase 'set -- "${s#$c1$c2$c3$c4}"' "1|" testcase 'set -- "${s#?}"' "1|$c2$c3$c4" testcase 'set -- "${s#??}"' "1|$c3$c4" testcase 'set -- "${s#???}"' "1|$c4" testcase 'set -- "${s#????}"' "1|" testcase 'set -- "${s#*$c3}"' "1|$c4" testcase 'set -- "${s%$c4}"' "1|$c1$c2$c3" testcase 'set -- "${s%$c3$c4}"' "1|$c1$c2" testcase 'set -- "${s%$c2$c3$c4}"' "1|$c1" testcase 'set -- "${s%$c1$c2$c3$c4}"' "1|" testcase 'set -- "${s%?}"' "1|$c1$c2$c3" testcase 'set -- "${s%??}"' "1|$c1$c2" testcase 'set -- "${s%???}"' "1|$c1" testcase 'set -- "${s%????}"' "1|" testcase 'set -- "${s%$c2*}"' "1|$c1" testcase 'set -- "${s##$c2}"' "1|$s" testcase 'set -- "${s##*}"' "1|" testcase 'set -- "${s##$c1}"' "1|$c2$c3$c4" testcase 'set -- "${s##$c1$c2}"' "1|$c3$c4" testcase 'set -- "${s##$c1$c2$c3}"' "1|$c4" testcase 'set -- "${s##$c1$c2$c3$c4}"' "1|" testcase 'set -- "${s##?}"' "1|$c2$c3$c4" testcase 'set -- "${s##??}"' "1|$c3$c4" testcase 'set -- "${s##???}"' "1|$c4" testcase 'set -- "${s##????}"' "1|" testcase 'set -- "${s##*$c3}"' "1|$c4" testcase 'set -- "${s%%$c4}"' "1|$c1$c2$c3" testcase 'set -- "${s%%$c3$c4}"' "1|$c1$c2" testcase 'set -- "${s%%$c2$c3$c4}"' "1|$c1" testcase 'set -- "${s%%$c1$c2$c3$c4}"' "1|" testcase 'set -- "${s%%?}"' "1|$c1$c2$c3" testcase 'set -- "${s%%??}"' "1|$c1$c2" testcase 'set -- "${s%%???}"' "1|$c1" testcase 'set -- "${s%%????}"' "1|" testcase 'set -- "${s%%$c2*}"' "1|$c1" test "x$failures" = x
Upload File
Create Folder