- Display current directory
- List directory
- Make directory
- Change directory
- Copy a file
- Rename a file
- Delete a file
- Edit a file
clear echo " 1 : Display Current Directory" echo " 2 : List directory" echo " 3 : Make Directory" echo " 4 : Change Directory" echo " 5 : Copy a file" echo " 6 : Rename a file" echo " 7 : Delete a file" echo " 8 : Edit a file" echo " ENTER CHOICE : "; read ch if [ $ch -eq 1 ];then echo "YOUR CHOICE IS TO DISPLAY CURRENT DIRECTORY" pwd=`pwd` echo "YOUR CURRENT DIRECTORY IS : $pwd" elif [ $ch -eq 2 ];then echo "YOUR CHOICE IS TO LIST THE FILE IN DIRECTORY" echo "FILE AND DIRECTORIES IN CURRENT DIRECTORY IS " echo `ls` elif [ $ch -eq 3 ];then echo "YOUR CHOICE IS TO CREATE DIRECTORY" echo "Enter Name Of Directory:"; read dir `mkdir $dir` echo "Directory Created successfully"; elif [ $ch -eq 4 ];then echo "YOUR CHOICE IS TO CHANGE DIRECTORY" echo "ENTER DIRECTORY TO CHANGE" read dir1 cd $dir1 echo "CHANGED SUCCESS "`pwd` elif [ $ch -eq 5 ];then echo "Enter file to COPY" read file echo "Enter Directory to which file is to be copied" read dir cp $file $dir elif [ $ch -eq 6 ];then echo "YOUR CHOICE IS TO RENAME A FILE" echo "ENTER FILE TO RENAME" read file echo "ENTER NEW NAME" read name mv $file $name elif [ $ch -eq 7 ];then echo "YOUR CHOICE IS TO DELETE A FILE" echo "ENTER FILE TO DELETE" read file rm -i $file elif [ $ch -eq 8 ];then echo "YOUR CHOICE IS TO EDIT A FILE" echo "ENTER FILENAME TO EDIT " read file echo "ENTER NEW DATA TO WRITE" read newdata echo $newdata > $file else echo "ENTER CORRECT OPTION" fi
Output:
0 comments:
Post a Comment