In: Computer Science
Write a bash script that will allow you to:
Ex:
If 10 is entered for the first number and 3 for the second, you should output
Your name
Course name
Instructor’s name
10 is greater than 3.
If 33 is entered for the first number and 100 for the second, you shou output
Your name
Course name
Instructor’s name
100 is greater than 33.
please write in linux/ unix code
CODE
#!/bin/bash
#reading name from user into name
read name
#reading course name from user into course
read course
#reading instructor name from user into instructor
read instructor
#prompting user to enter 1st number and store it to n1
echo "Enter number 1: "
read n1
#prompting user to enter 2nd number and store it to n2
echo "Enter number 2: "
read n2
#printing output
echo
echo $name
echo $course
echo $instructor
#checking if n1 greater than n2, if so it prints n1 is greater than n2
if [ $n1 -gt $n2 ]
then
echo "$n1 is greater than $n2"
fi
#checking if n2 greater than n1, if so it prints n2 is greater than n1
if [ $n2 -gt $n1 ]
then
echo "$n2 is greater than $n1"
fi
CODE SCREENSHOT
OUTPUT