19 lines
297 B
Bash
Executable File
19 lines
297 B
Bash
Executable File
#!/bin/bash
|
|
|
|
read -p "please enter a phrase: " text
|
|
|
|
if [[ -z "$text" ]]; then
|
|
echo "please enter a string"
|
|
exit
|
|
fi
|
|
|
|
count=0
|
|
|
|
for ((i=0; i<${#text}; i++)); do
|
|
char="${text:i:1}"
|
|
if [[ "$char" =~ [A-Za-z]]]; then
|
|
count++
|
|
fi
|
|
done
|
|
|
|
echo "Your string contain $count letter" |