About menu using dd command utility

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    Please help about these script... i dont have a problem in option 1. But when it comes to options 2 and options 3 i have.. My questions in # 2 options is, when i choose it, the file contents should translate in upper case . My questions in # 3 options is, when i choose it, the file contents should translate in lower case... ?? what is the prob.. in my script??

  2. Relevant commands, code, scripts, algorithms:

#!/bin/bash
clear

        echo "Menu "

        echo "1. COpy a File using dd command "

        echo "2. Translate file contents to upper case "

        echo "3. Translate file contents to upper case "

        echo "4. Quit"

        echo "Enter ur Choice"

        read Choice

        case $Choice in

           1) echo "Enter File name to copy"
	      read f1

              echo "Enter FIle name"

          read f2

          if [ -f $f1 ]

          then
dd $1 if=$f1 of=$f1.copy

              else

                     echo "$f1 does not exist"

              fi

              ;;
2) echo "Enter the File to be converted to upper case"

             read r1

             if [ -f $r1 ]

             then

                   dd $1 $2 if=$r1 of=$r2.copy conv=ucase

             else

                  echo "$r1 file does not exist"

             fi

             ;;

3)
            echo "Enter File name to move \c"
            read f1
            echo "Enter destination \c "
            read f2
            if [ -f $f1 ]
             then 
                 if [ -d $f2 ]
                 then
                      dd $1 $2 if=$r1 of=$r2.copy conv=ucase
                 fi
             else
                 echo "$f1 does not exist"
            fi
            ;;
         4) 
             echo "Exit......."
             exit;;
        esac
  1. The attempts at a solution (include all code and scripts):
#!/bin/bash
clear

        echo "Menu "

        echo "1. COpy a File using dd command "

        echo "2. Translate file contents to upper case "

        echo "3. Translate file contents to upper case "

        echo "4. Quit"

        echo "Enter ur Choice"

        read Choice

        case $Choice in

           1) echo "Enter File name to copy"
	      read f1

              echo "Enter FIle name"

          read f2

          if [ -f $f1 ]

          then
dd $1 if=$f1 of=$f1.copy

              else

                     echo "$f1 does not exist"

              fi

              ;;
2) echo "Enter the File to be converted to upper case"

             read r1

             if [ -f $r1 ]

             then

                   dd $1 $2 if=$r1 of=$r2.copy conv=ucase

             else

                  echo "$r1 file does not exist"

             fi

             ;;

3)
            echo "Enter File name to move \c"
            read f1
            echo "Enter destination \c "
            read f2
            if [ -f $f1 ]
             then 
                 if [ -d $f2 ]
                 then
                      dd $1 $2 if=$r1 of=$r2.copy conv=ucase
                 fi
             else
                 echo "$f1 does not exist"
            fi
            ;;
         4) 
             echo "Exit......."
             exit;;
        esac
  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    A. Philip Randolph Campus High School ( M540), new york, Mr. delhi, ict OS 1

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Are you getting any error messages? If so, what are they. It might also help to know what operating system and shell you are working with.

The one thing that jumps out at me from your script is

 dd $1 $2 if=$r1 of=$r2.copy conv=ucase

I'm not sure what is being passed into the script as command line parameters, but passing $1 and $2 on the dd commands for menu options 3 and 4 seem wrong.

And how can i correct it ??