Convert text to Uppercase & Lowercase
Convert text to Uppercase & Lowercase
#!/bin/bash
echo -n "Enter File Name : "
read fileName
if [ ! -f $fileName ]; then
echo "Filename $fileName does not exists"
exit 1
fi
GREEN='\033[1;32m'
UpLow='Choose Conversion Type: '
choiceul=("From Lowercase to Uppercase" "From Uppercase to Lowercase")
select fav in "${choiceul[@]}"; do
case $fav in
"From Lowercase to Uppercase")
tr '[a-z]' '[A-Z]' <$fileName >Uppercase.txt
echo -e "Text in File Converted From Lowercase to Uppercase, Check ${GREEN}Uppercase.txt"
break;;
"From Uppercase to Lowercase")
tr '[A-Z]' '[a-z]' <$fileName >Lowercase.txt
echo -e "Text in File Converted From Lowercase to Uppercase, Check ${GREEN}Lowercase.txt"
break;;
"Quit")
echo "User requested exit"
exit;;
*) echo "invalid option $REPLY";;
esac
done