]>
Commit | Line | Data |
---|---|---|
deb63bfb | 1 | # $FreeBSD: head/bin/sh/tests/parser/case1.0 207824 2010-05-09 17:10:50Z jilles $ |
71aad674 A |
2 | |
3 | keywords='if then else elif fi while until for do done { } case esac ! in' | |
4 | ||
5 | # Keywords can be used unquoted in case statements, except the keyword | |
6 | # esac as the first pattern of a '|' alternation without a starting '('. | |
7 | # (POSIX doesn't seem to require (esac) to work.) | |
8 | for k in $keywords; do | |
9 | eval "case $k in (foo|$k) ;; *) echo bad ;; esac" | |
10 | eval "case $k in ($k) ;; *) echo bad ;; esac" | |
11 | eval "case $k in foo|$k) ;; *) echo bad ;; esac" | |
12 | [ "$k" = esac ] && continue | |
13 | eval "case $k in $k) ;; *) echo bad ;; esac" | |
14 | done |