#!/bin/bash
read -p "Do you like music? " ans
answer=${ans^}
echo "Your answer is $answer."
$./case1.sh
Do you like music? yes
Your answer is Yes.
#!/bin/bash
a=15
b=20
read -p "Do you want to add or subtract? " ans
answer=${ans^^}
if [ $answer == 'ADD' ]; then
echo "The result of addition=$((a+b))"
elif [ $answer == 'SUBTRACT' ]; then
echo "The result of subtraction=$((a-b))"
else
echo "Invalid answer"
fi
#!/bin/bash
read -p "Enter some text data: " data
read -p "Mention the letters with the comma that will convert to uppercase?: " list
echo -n "The highlighted text is : "
echo ${data^^[$list]}
$bash case3.sh
Enter some text data: welcome to west world
Mention the letters with the comma that will convert to uppercase?: w,d
The highlighted text is : Welcome to West WorlD
#!/bin/bash
username='admin'
password='pop890'
read -p "Enter username: " u
read -p "Enter password: " p
user=${u,,}
pass=${p,,}
if [ $username == $user ] && [ $password == $pass ]; then
echo "Valid User"
else
echo "Invalid User"
fi