2010. 9. 1. 13:55

(unix)shell script CASE문 예제

#!/bin/bash
while [ : ]
do
        echo
        echo -n "Press any key and hit Enter. To stop, enter @ : "
        read char
        case $char in
                "@"   ) break;;
               
[A-Z][A-Z][A-Z]
) echo "uppercase";;
                [0-9][0-9][0-9]
) echo "digit";;
                [a-z][a-z][a-z]
) echo "lowercase";;
                *     ) echo "other" ;;
        esac
done
exit 0