Lab 6: write a menu driven program to demonstrate commmands a) cat b)Who c)ls
while [ 1 ]
do
echo "menu"
echo "1.cat"
echo "2.who"
echo "3.ls"
echo "Enter the choice"
read choice
case $choice in
1) echo "Enter the name of the file to create"
read filename
echo "Now start entering the contant of the file and save by pressing ctrl+d"
cat>$filename;;
2) echo "Display all those user who r currently logged in to the system"
who;;
3) echo "Listing all files and directories"
ls;;
4) exit;;
*) echo "Invalid choice";;
esac
done
do
echo "menu"
echo "1.cat"
echo "2.who"
echo "3.ls"
echo "Enter the choice"
read choice
case $choice in
1) echo "Enter the name of the file to create"
read filename
echo "Now start entering the contant of the file and save by pressing ctrl+d"
cat>$filename;;
2) echo "Display all those user who r currently logged in to the system"
who;;
3) echo "Listing all files and directories"
ls;;
4) exit;;
*) echo "Invalid choice";;
esac
done
Leave a Comment