Header Ads

Shell program to count numbers of consonants & vowels in a given sentence


!/bin/bash
read -p "Enter a sentence " s
a=$( echo $s | tr -cd 'AaEeIiOouU' | wc -c)
echo " Number of vowels $a"
b=$( echo $s | tr -cd 'BbCcDdFfGgHhJjKkLlMmNnPpQqRrSsTtVvWwXxYyZz' | wc -c)
echo " Number of consonents is $b "






No comments

Powered by Blogger.