1) Write a shell script to ask your name,
program name and enrollment number and print it on the screen.
Echo
“Enter your name:”
Read
Name
Echo
“Enter your program name:”
Read
Prog
Echo
“Enter your enrollment number:”
Read
Enroll
Clear
Echo
“Details you entered”
Echo
Name: $Name
Echo
Program Name: $Prog
Echo
Enrolment Number: $Enroll
2) Write a shell script to find the sum, the
average and the product of the four integers entered
Echo
“Enter four integers with space between”
Read
a b c d
Sum
=`expr $a + $b + $c + $d`
Avg
=`expr $sum / 4`
Dec
=`expr $sum % 4`
Dec
=`expr \ ($dec \* 1000 \) / 4`
Product
=`expr $a \* $b \* $c \* $d`
Echo
Sum = $sum
Echo
Average = $avg. $dec
Echo
Product = $product
1 comments:
Hi Suresh Babu,
You make learning and reading addictive. All eyes fixed on you. Thank you being such a good and trust worthy guide.
I am a python beginner, I have a scenario where I need to search and select a particular value from linux command "df -h".
dumpe2fs 1.42.13.x5 (23-Mar-2017)
Inode count: 786432000
In this above output I need to store the inode count number in to a variable to use it for further calculation.
Can anyone explain how to use python regular expressions to do the above task?
Thanks a lot. This was a perfect step-by-step guide. Don’t think it could have been done better.
Cheers,
Morgan lee
EmoticonEmoticon