Lab Programs
Telnet Login
cmd
telnet [Link]
User name-exam1
Password- exam1
Script 1: Shell script to find the
GCD and LCM of two numbers.
• while [ $n1 != $n2 ]
do
if [ $n1 -gt $n2 ]
then
n1=`expr $n1 - $n2`
else
n2=`expr $n2 - $n1`
fi
done
To convert all the contents of a particular file
into the uppercase
tr \'[a-z]\' \'[A-Z]' < $filename
• Note: tr abbreviated as translate or transliterate
Code for Script to find the value of one number raised to the power of another
counter=0
ans=1
while [ $power -ne $counter ]
do
ans=`expr $ans \* $no`
counter=`expr $counter + 1`
done
echo "$no power of $power is $ans"
Write a program to generate all combinations of 1, 2 and 3
using for loops.
for i in 1 2 3
do
for j in 1 2 3
do
for k in 1 2 3
do
echo $i $j $k
done
done
done
WASS that repeatedly asks the user repeatedly for the “Name of
the Institution” until the user gives the correct answer.
if [ $inst = "AMITY" ]
then
echo Correct Answer
flag=1
else
echo Enter Again
fi