This document outlines 5 shell scripting exercises: 1) print a user-input name, 2) print a user-input number, 3) add two user-input numbers, 4) find the smaller of two user-input numbers, and 5) check if a user-input username and password match valid credentials. The document was created on January 10, 2022 by Raminedi Santhosh for their Operating System Lab-2 assignment.
This document outlines 5 shell scripting exercises: 1) print a user-input name, 2) print a user-input number, 3) add two user-input numbers, 4) find the smaller of two user-input numbers, and 5) check if a user-input username and password match valid credentials. The document was created on January 10, 2022 by Raminedi Santhosh for their Operating System Lab-2 assignment.
This document outlines 5 shell scripting exercises: 1) print a user-input name, 2) print a user-input number, 3) add two user-input numbers, 4) find the smaller of two user-input numbers, and 5) check if a user-input username and password match valid credentials. The document was created on January 10, 2022 by Raminedi Santhosh for their Operating System Lab-2 assignment.
M Date: 10-01-2022 NAME: RAMINEDI SANTHOSH REG NO: 20BCE1477
(1) Print a name
echo "ENTER YOUR NAME"
read name echo "WELCOME", $name
(2) Print a number
echo "ENTER A NUMBER"
read number echo "THE NUMBER IS",$number
(3) Addition of TWO numbers
echo "ENTER FIRST NUMBER"
read number1 echo "ENTER SECOND NUMBER" read number2 echo "THE ADDITION OF TWO NUMBERS IS", $(( $number1 + $number2 ))
(4) Find the smallest of TWO numbers
echo "ENTER TWO NUMBERS"
read number1 read number2 if [ $number1 -lt $number2 ] then echo "$number1 is smaller" else echo "$number2 is smaller" fi (5) User is valid or not
echo "ENTER USERNAME"
read username echo "ENTER PASSWORD" read password if [[ ($username == "admin" && $password == "admin") ]] then echo "YOU ARE A VALID USER" else echo "YOU ARE A INVALID USER" fi Output1 Output2