Denis Vlasenko | be709c2 | 2008-07-28 00:01:16 +0000 | [diff] [blame] | 1 | case w in a) echo SKIP;; w) echo OK_1;; w) echo WRONG;; esac |
| 2 | |
Denis Vlasenko | f173607 | 2008-07-31 10:09:26 +0000 | [diff] [blame] | 3 | case w in |
| 4 | a) echo SKIP;; |
| 5 | w)echo OK_1 ;; |
| 6 | w) |
| 7 | echo WRONG |
| 8 | ;; |
| 9 | esac |
| 10 | |
Denis Vlasenko | be709c2 | 2008-07-28 00:01:16 +0000 | [diff] [blame] | 11 | t=w |
| 12 | case $t in a) echo SKIP;; w) echo OK_21;; w) echo WRONG;; esac; |
| 13 | case "$t" in a) echo SKIP;; w) echo OK_22;; w) echo WRONG;; esac; |
| 14 | case w in a) echo SKIP;; $t) echo OK_23;; "$t") echo WRONG;; esac; |
| 15 | |
| 16 | case '' in a) echo SKIP;; w) echo WRONG;; *) echo OK_31;; esac; |
| 17 | case '' in a) echo SKIP;; '') echo OK_32;; *) echo WRONG;; esac; |
| 18 | |
| 19 | case `echo w` in a) echo SKIP;; w) echo OK_41;; w) echo WRONG;; esac; |
| 20 | case "`echo w`" in a) echo SKIP;; w) echo OK_42;; w) echo WRONG;; esac; |
| 21 | case `echo w w` in a) echo SKIP;; w) echo WRONG;; 'w w') echo OK_43;; esac; |
| 22 | case `echo w w` in a) echo SKIP;; w) echo WRONG;; w*) echo OK_44;; esac; |
| 23 | |
| 24 | case w in `echo w`) echo OK_51;; `echo WRONG >&2`w) echo WRONG;; esac; |
| 25 | case w in `echo OK_52 >&2`) echo SKIP;; `echo`w) echo OK_53;; esac; |
Mike Frysinger | 7b424fe | 2009-05-21 18:09:24 -0400 | [diff] [blame^] | 26 | |
| 27 | # parsing cases in subshells can easily get messy |
| 28 | case m in m) echo ok-sub1;; esac |
| 29 | case m in (m) echo ok-sub2;; esac |
| 30 | (case m in m) echo ok-sub3;; esac) |
| 31 | (case m in (m) echo ok-sub4;; esac) |
| 32 | ( |
| 33 | case m in m) echo ok-sub5;; esac |
| 34 | ) |
| 35 | ( |
| 36 | case m in (m) echo ok-sub6;; esac |
| 37 | ) |