Bash-4.3 distribution sources and documentation
[platform/upstream/bash.git] / tests / case.tests
1 case foo in
2 bar)    echo skip ;;
3 foo)    echo fallthrough ;&
4 bax)    echo to here ;&
5 qux)    echo and here;;
6 fop)    echo but not here;;
7 esac
8
9 case foobar in
10 bar)    echo skip ;;
11 foo*)   echo retest ;;&
12 *bar)   echo and match ;;&
13 qux)    echo but not this ;;
14 esac
15
16 case a in
17 a)      echo no more clauses;&
18 esac
19
20 x=0 y=1
21 case 1 in
22   $((y=0)) ) ;;
23   $((x=1)) ) ;&
24   $((x=2)) ) echo $x.$y ;;
25 esac
26
27 unset x
28 readonly xx=1
29 case 1 in $((xx++)) ) echo hi1 ;; *) echo hi2; esac
30 echo ${xx}.$?
31
32 # tests of quote removal and pattern matching
33 ${THIS_SH} ./case1.sub