Here we'll make a simple calculator using SWITCH program and execute the Read command and out put in different colors.
The bash case statement is generally used to simplify complex conditionals when you have multiple different choices.
####################
#Program :Switch #
#Created by :Ajay #
####################
#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
nc='\033[0m'
#defining the 2 terms
read -p $'\e[33mEnter number 1\e[0m: ' num1
read -p $'\e[33mEnter number 2\e[0m: ' num2
#to find which function to perform
echo ""
echo " Option for operation choices "
echo " 1.addition "
echo " 2.subtraction "
echo " 3.multiplication "
echo " 4.division "
echo ""
#read the selected option
read -p " Enter the choice of operation: " S1
echo ""
#the switch function for simple calculater
case $S1 in
1) echo " The result = $(( $num1+$num2 )) " ;;
2) echo " The result = $(( $num1-$num2 )) " ;;
3) echo " The result = $(( $num1*$num2 )) " ;;
4) echo " The result = $(( $num1/$num2 )) " ;;
*) read -p " Please choose only from 1,2,3 and 4 " ;;
esac

