]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/expansion/cmdsubst2.0
shell_cmds-207.11.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / cmdsubst2.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/expansion/cmdsubst2.0 205105 2010-03-12 23:23:46Z jilles $
71aad674
A
2
3failures=0
4
5check() {
6 if ! eval "[ $* ]"; then
7 echo "Failed: $*"
8 : $((failures += 1))
9 fi
10}
11
12check '`echo /et[c]/` = "/etc/"'
13check '`printf /var/empty%s /et[c]/` = "/var/empty/etc/"'
14check '"`echo /et[c]/`" = "/etc/"'
15check '`echo "/et[c]/"` = "/etc/"'
16check '`printf /var/empty%s "/et[c]/"` = "/var/empty/et[c]/"'
17check '`printf /var/empty/%s \"/et[c]/\"` = "/var/empty/\"/et[c]/\""'
18check '"`echo \"/et[c]/\"`" = "/et[c]/"'
19check '"`echo "/et[c]/"`" = "/et[c]/"'
20check '`echo $$` = $$'
21check '"`echo $$`" = $$'
22check '`echo \$\$` = $$'
23check '"`echo \$\$`" = $$'
24
25# Command substitutions consisting of a single builtin may be treated
26# differently.
27check '`:; echo /et[c]/` = "/etc/"'
28check '`:; printf /var/empty%s /et[c]/` = "/var/empty/etc/"'
29check '"`:; echo /et[c]/`" = "/etc/"'
30check '`:; echo "/et[c]/"` = "/etc/"'
31check '`:; printf /var/empty%s "/et[c]/"` = "/var/empty/et[c]/"'
32check '`:; printf /var/empty/%s \"/et[c]/\"` = "/var/empty/\"/et[c]/\""'
33check '"`:; echo \"/et[c]/\"`" = "/et[c]/"'
34check '"`:; echo "/et[c]/"`" = "/et[c]/"'
35check '`:; echo $$` = $$'
36check '"`:; echo $$`" = $$'
37check '`:; echo \$\$` = $$'
38check '"`:; echo \$\$`" = $$'
39
40check '`set -f; echo /et[c]/` = "/etc/"'
41check '"`set -f; echo /et[c]/`" = "/et[c]/"'
42
43exit $((failures > 0))