OSA Assignment #4

Implement the commands for creation and deletion of the directory. Write a program to change the current working directory and display the node details for each file in the new directory.

#!/bin/bash
while true
do
echo "menu"
echo "1.make directory"
echo "2.change directory"
echo "3.remove directory"
echo "4.display"
echo "5.exit"
echo "enter ur choice"
read ch
case $ch in
1) echo "enter directory name"
read d1
if [ -d $d1 ]
then
echo "directory is present"
else
mkdir $d1
echo "$d1 directory is created"
fi
;;
2) ls -d
echo "enter the directory name"
read d1
if [ -d $d1 ]
then
cd $d1
pwd
else
echo "error"
fi
;;
3) echo "enter the directory name for deletion"
read $d1
if [ -d $d1 ]
then
rmdir $d1
echo "$d1 directory is deleted"
else
echo "no such a directory for deletion"
fi
;;
4) ls -l
;;
5) exit ;;
esac
done
SHARE
    Blogger Comment
    Facebook Comment