0% found this document useful (0 votes)
15 views5 pages

Practical 10

The document contains a series of shell script examples that prompt users for input and evaluate conditions based on the input values. Practical 10.1 checks student marks to determine pass/fail status in three subjects, Practical 10.2 identifies the largest of three numbers, Practical 10.3 displays the user's name, and Practical 10.4 compares two numbers to find which is greater. Each practical includes example outputs based on user inputs.

Uploaded by

hasanfadnis05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Practical 10

The document contains a series of shell script examples that prompt users for input and evaluate conditions based on the input values. Practical 10.1 checks student marks to determine pass/fail status in three subjects, Practical 10.2 identifies the largest of three numbers, Practical 10.3 displays the user's name, and Practical 10.4 compares two numbers to find which is greater. Each practical includes example outputs based on user inputs.

Uploaded by

hasanfadnis05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practical 10.

echo "enter marks of OSY"

read OSY

echo "enter marks of AJP"

read AJP

echo "enter marks of STE"

read STE

if [ $OSY -gt 28 ] && [ $AJP -gt 28 ] && [ $STE -gt 28 ]

then

echo "congrats ! you have passed in all subjects"

elif [ $OSY -lt 28 ] && [ $AJP -lt 28 ] && [ $STE -lt 28 ]

then

echo "you failed in all subject"

elif [ $OSY -lt 28 ] && [ $AJP -lt 28 ] && [ $STE -gt 28 ]

then

echo "you passed in STE"

elif [ $OSY -lt 28 ] && [ $AJP -gt 28 ] && [ $STE -lt 28 ]

then

echo "you passed in AJP"

elif [ $OSY -gt 28 ] && [ $AJP -lt 28 ] && [ $STE -lt 28 ]

then

echo "you passed in OSY"

elif [ $OSY -lt 28 ] && [ $AJP -gt 28 ] && [ $STE -gt 28 ]

then

echo "you passed in AJP and STE"

elif [ $OSY -gt 28 ] && [ $AJP -lt 28 ] && [ $STE -gt 28 ]

then
echo "you passed in OSY and STE"

elif [ $OSY -lt 28 ] && [ $AJP -lt 28 ] && [ $STE -lt 28 ]

then

echo "you failed in all subject"

elif [ $OSY -gt 28 ] && [ $AJP -gt 28 ] && [ $STE -lt 28 ]

then

echo "you have passed in OSY and AJP"

fi

Output:

enter marks of OSY

22

enter marks of AJP

33

enter marks of STE

44

you passed in AJP and STE


Practical 10.2

echo "Enter the first number:"

read v1

echo "Enter the second number:"

read v2

echo "Enter the third number:"

read v3

if [ $v1 -gt $v2 ] && [ $v1 -ge $v3 ]

then

echo "$v1 is greater"

elif [ $v2 -gt $v1 ] && [ $v2 -ge $v3 ]

then

echo "$v2 is greater"

else

echo "$v3 is greater"

fi

Output:

Enter the first number:

Enter the second number:

Enter the third number:

4 is greater
Practical 10.3

echo "Enter your name:"

read v1

echo "Your name is: $v1"

Output:

Enter your name:

Sahil

Your name is Sahil


Practical 10.4

echo "enter first number"

read num1

echo "enter second number"

read num2

if[num1 -gt num2]

then

echo "first is greater"

fi

Output:

Enter first number

10

Enter second number

First is greater

You might also like