blob: d72b57f53a25a9f417d310568c488c33deb5771d [file] [log] [blame]
Denis Vlasenkobe709c22008-07-28 00:01:16 +00001case w in a) echo SKIP;; w) echo OK_1;; w) echo WRONG;; esac
2
Denis Vlasenkof1736072008-07-31 10:09:26 +00003case w in
4 a) echo SKIP;;
5 w)echo OK_1 ;;
6 w)
7 echo WRONG
8 ;;
9esac
10
Denis Vlasenkobe709c22008-07-28 00:01:16 +000011t=w
12case $t in a) echo SKIP;; w) echo OK_21;; w) echo WRONG;; esac;
13case "$t" in a) echo SKIP;; w) echo OK_22;; w) echo WRONG;; esac;
14case w in a) echo SKIP;; $t) echo OK_23;; "$t") echo WRONG;; esac;
15
16case '' in a) echo SKIP;; w) echo WRONG;; *) echo OK_31;; esac;
17case '' in a) echo SKIP;; '') echo OK_32;; *) echo WRONG;; esac;
18
19case `echo w` in a) echo SKIP;; w) echo OK_41;; w) echo WRONG;; esac;
20case "`echo w`" in a) echo SKIP;; w) echo OK_42;; w) echo WRONG;; esac;
21case `echo w w` in a) echo SKIP;; w) echo WRONG;; 'w w') echo OK_43;; esac;
22case `echo w w` in a) echo SKIP;; w) echo WRONG;; w*) echo OK_44;; esac;
23
24case w in `echo w`) echo OK_51;; `echo WRONG >&2`w) echo WRONG;; esac;
25case w in `echo OK_52 >&2`) echo SKIP;; `echo`w) echo OK_53;; esac;
Mike Frysinger7b424fe2009-05-21 18:09:24 -040026
27# parsing cases in subshells can easily get messy
Denys Vlasenkoe9bda902009-05-23 16:50:07 +020028 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)
Mike Frysinger7b424fe2009-05-21 18:09:24 -040032(
Denys Vlasenkoe9bda902009-05-23 16:50:07 +020033 case m in m) echo OK_sub5;; esac
Mike Frysinger7b424fe2009-05-21 18:09:24 -040034)
35(
Denys Vlasenkoe9bda902009-05-23 16:50:07 +020036 case m in (m) echo OK_sub6;; esac
Mike Frysinger7b424fe2009-05-21 18:09:24 -040037)
Denys Vlasenkoe9bda902009-05-23 16:50:07 +020038(case esac in "esac") echo OK_esac1;; esac)
39
40echo Done