xref: /freebsd/bin/sh/tests/parser/case1.0 (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1
2keywords='if then else elif fi while until for do done { } case esac ! in'
3
4# Keywords can be used unquoted in case statements, except the keyword
5# esac as the first pattern of a '|' alternation without a starting '('.
6# (POSIX doesn't seem to require (esac) to work.)
7for k in $keywords; do
8	eval "case $k in (foo|$k) ;; *) echo bad ;; esac"
9	eval "case $k in ($k) ;; *) echo bad ;; esac"
10	eval "case $k in foo|$k) ;; *) echo bad ;; esac"
11	[ "$k" = esac ] && continue
12	eval "case $k in $k) ;; *) echo bad ;; esac"
13done
14