case1.0 revision 207824
1207824Sjilles# $FreeBSD: head/tools/regression/bin/sh/parser/case1.0 207824 2010-05-09 17:10:50Z jilles $ 2207824Sjilles 3207824Sjilleskeywords='if then else elif fi while until for do done { } case esac ! in' 4207824Sjilles 5207824Sjilles# Keywords can be used unquoted in case statements, except the keyword 6207824Sjilles# esac as the first pattern of a '|' alternation without a starting '('. 7207824Sjilles# (POSIX doesn't seem to require (esac) to work.) 8207824Sjillesfor k in $keywords; do 9207824Sjilles eval "case $k in (foo|$k) ;; *) echo bad ;; esac" 10207824Sjilles eval "case $k in ($k) ;; *) echo bad ;; esac" 11207824Sjilles eval "case $k in foo|$k) ;; *) echo bad ;; esac" 12207824Sjilles [ "$k" = esac ] && continue 13207824Sjilles eval "case $k in $k) ;; *) echo bad ;; esac" 14207824Sjillesdone 15