Debian Codegraph @

case4.sh

raw symbols SCIP
1 #!/bin/bash4
2
3 test_char ()
4 {
5 case "$1" in
6 [[:print:]] ) echo "$1 is a printable character.";;& # |
7 # The ;;& terminator continues to the next pattern test. |
8 [[:alnum:]] ) echo "$1 is an alpha/numeric character.";;& # v
9 [[:alpha:]] ) echo "$1 is an alphabetic character.";;& # v
10 [[:lower:]] ) echo "$1 is a lowercase alphabetic character.";;&
11 [[:digit:]] ) echo "$1 is an numeric character.";& # |
12 # The ;& terminator executes the next statement ... # |
13 %%%@@@@@ ) echo "********************************";; # v
14 # ^^^^^^^^ ... even with a dummy pattern.
15 esac
16 }
17
18 echo
19
20 test_char 3
21 # 3 is a printable character.
22 # 3 is an alpha/numeric character.
23 # 3 is an numeric character.
24 # ********************************
25 echo
26
27 test_char m
28 # m is a printable character.
29 # m is an alpha/numeric character.
30 # m is an alphabetic character.
31 # m is a lowercase alphabetic character.
32 echo
33
34 test_char /
35 # / is a printable character.
36
37 echo
38
39 # The ;;& terminator can save complex if/then conditions.
40 # The ;& is somewhat less useful.