• Arun Kumar

Shell Script to Check Vowels

Linux script allows the user to use the case command that accepts the input from the user and match the answer. To elaborate this we are asking the question Enter any vowel and the script will accept the answer in both upper case and lower case.


vi vowel_check.sh
# !bin/bash

echo Enter any vowel?
read response
case $response in
A) echo $response is correct ;;
a) echo $response is correct ;;
E) echo $response is correct ;;
e) echo $response is correct ;;
I) echo $response is correct ;;
i) echo $response is correct ;;
O) echo $response is correct ;;
o) echo $response is correct ;;
U) echo $response is correct ;;
u) echo $response is correct ;;
*) echo sorry, that is wrong
esac

Here is the sample output of the above script

shell script to check vowels

More ways to use case

  • You can use the case command to accept the user input and match the case

  • You can ask for user input and evaluate it using case command and returns the response

99 views

Recent Posts

See All