Home » » Shell Scripting Tutorial For Beginners Xiii - The Instance Tilt Example

Shell Scripting Tutorial For Beginners Xiii - The Instance Tilt Example



#! /bin/bash  echo -e "Enter roughly grapheme : \c" read value   case $value in     [a-z] )         echo "User entered $value a to z" ;;     [A-Z] )         echo "User entered $value Influenza A virus subtype H5N1 to Z" ;;     [0-9] )         echo "User entered $value 0 to 9" ;;     ? )         echo "User entered $value exceptional character" ;;     * )         echo "Unknown input" ;; esac 
Output:


test@test$ ./hello.sh  Enter roughly grapheme : f User entered f a to z test@test$ ./hello.sh  Enter roughly grapheme : K User entered K a to z test@test$ LANG=C test@test$ ./hello.sh  Enter roughly grapheme : K User entered K Influenza A virus subtype H5N1 to Z test@test$ ./hello.sh  Enter roughly grapheme : 9 User entered nine 0 to 9 test@test$ ./hello.sh  Enter roughly grapheme : 5 User entered five 0 to 9 test@test$ ./hello.sh  Enter roughly grapheme : & User entered & exceptional character test@test$ ./hello.sh  Enter roughly grapheme : sdsdsdsd Unknown input test@test$  

0 comments:

Post a Comment

Search

Blog Archive