Lab – Linux Shell Scripts Assessments
1) Lab – Linux Shell Scripts Assessments
ch=0 while [ $ch -ne 7 ] do echo "===================================================================================" echo "| CHOOSE ANY ONE |" echo "===================================================================================" echo "| 1 . CPU information |" echo "| 2 . RAM information |" echo "| 3 . Kernel information |" echo "| 4 . OS version |" echo "| 5 . Hostname |" echo "| 6 . Ipaddress |" echo "| 7 . Exit |" echo "===================================================================================" echo " Enter your Choice : " read ch case $ch in 1) echo `lscpu`;; 2) echo `cat /proc/meminfo|grep -i memt`;; 3) echo `uname -r`;; 4) echo `cat /etc/redhat-release`;; 5) echo `hostname`;; 6) echo `hostname -i`;; *) echo "Invalid Option" esac done
2) Lab – Linux Shell Scripts Assessments
chk=”Checking.”
found=0
while [ $found -ne 1 ] do
if [ -e “/home/oracle/sfile/excel_19112020.txt” ] then
found=1
echo “File Received”
else
#echo “Not Found”
chk+=”.”
clear
echo “$chk”
fi
sleep 2
done
found=0
while [ $found -ne 1 ] do
if [ -e “/home/oracle/sfile/excel_19112020.txt” ] then
found=1
echo “File Received”
else
#echo “Not Found”
chk+=”.”
clear
echo “$chk”
fi
sleep 2
done
3) Lab – Linux Shell Scripts Assessments
if [ $1 -ge 1 ] && [ $1 -le 12 ]
then
echo “Good Morning!!!”
elif [ $1 -ge 12 ] && [ $1 -le 18 ] then
echo “Good Afternoon!!!”
else
echo “Good Night!!!”
fi
echo “Good Morning!!!”
elif [ $1 -ge 12 ] && [ $1 -le 18 ] then
echo “Good Afternoon!!!”
else
echo “Good Night!!!”
fi