Posts

Showing posts with the label Unix

Unix Shell Script Program List 1 to 10

SCRIPT-1 Write a shell script which reads your name and department and print a message. echo "What is your name?" read nm echo "In which department are you?" read dept echo "My name is $nm." echo "I'm a $dept Student." OUTPUT: $ ./a.sh What is your name? admin In which department are you? BCA My name is admin. I'm a BCA Student. SCRIPT - 2 Write a shell script to check whether numbers are same or not. echo "Enter first number" read a echo "Enter second number" read b if [ $a == $b ] then echo "a is equal to b" else echo "a is not equal to b" fi OUTPUT $ ./n1.sh Enter first number 30 Enter second number 20 a is not equal to b SCRIPT-3 Write a shell script to check number using if..else. echo "Enter number" read count if [ $count -eq 100 ] then echo "Count is 100" elif [ $count -gt 100 ] then echo "Count is greater than 100"