Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script to perform operations like display, list, make directory and copy, rename, delete, edit file

Posted By: Mohammed Evans     Category: Unix / Linux / Ubuntu     Views: 16079

Write a shell script to perform operations like display directory, list directory, make directory and copy file, rename file, delete file, edit file.

Code for Shell script to perform operations like display, list, make directory and copy, rename, delete, edit file in Unix / Linux / Ubuntu

clear
i="y"while [ $i = "y" ]
do
echo "1.Display current dir"
echo "2.Listing the dir"
echo "3.Make a dir"
echo "4.Copy a file"
echo
i="y"while [ $i = "y" ]
do
echo "1.Display current dir"
echo "2.Listing the dir"
echo "3.Make a dir"
echo "4.Copy a file"
echo "5.Rename file"
echo "6.Delete file"
echo "7.Edit file"
echo "8.Exit"
echo "Enter your choice"
read ch
case $ch in
1)echo "Current Dir is : "
  pwd;;
  2)echo "Directories are"

    ls;;
    3)echo "Enter dir name to create"
     read d
             mkdir $d
                 echo $d" Dir is created";;
             4)echo "Enter filename from copy"
              read f1
               echo "Enter filenm2 to be copied"
                read f2
                    #cat $f1 > $f2
                        cp $f1 $f2
                            echo $f2" is copied from "$f1;;
                        5)echo "Enter file name to rename"
                         read f1
                          echo "Enter new name of file"
                           read f2
                                   mv $f1 $f2
                                       echo $f1" is renamed as "$f2;;
                                   6)echo "Enter any filenm to be delete"
                                    read f1
                                            rm $f1
                                                echo $f1" is deleted";;
                                            7)echo "Enter any file to be editing "
                                             read f1
                                                     vi $f1;;

                                                 8)echo "Have a nice time"
                                                 exit;;
                                                 *)echo "Invalid choice entered";;
                                                 esac
                                                 echo "Do u want to continue ? "
                                                 read i
                                                 if [ $i != "y" ]
                                                 then
                                                 exit
                                                 fi
                                                 done
  
Share: 



Mohammed Evans
Mohammed Evans author of Shell script to perform operations like display, list, make directory and copy, rename, delete, edit file is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!