1# $FreeBSD$ 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)) 44