About menu using dd command utility

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions About menu using dd command utility
# 1  
Old 03-05-2012
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:

Code:
#!/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

3. The attempts at a solution (include all code and scripts):
Code:
#!/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


4. 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).
# 2  
Old 03-06-2012
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
Code:
 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.
# 3  
Old 03-06-2012
And how can i correct it ??
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

2. Homework & Coursework Questions

How to invent new 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: Develop a utility that will enhance the current file management and organization functions of Linux. You... (3 Replies)
Discussion started by: stephanielana1
3 Replies

3. UNIX for Dummies Questions & Answers

FTP command-line utility usage

Hi, Using command-line utility "ftp or sftp", I want to transfer files across Windows and UNIX. Can you please tell me from where I need to connect to ftp and how do I specify the hostname, credentials and how do I get and put files between DOS and UNIX? Please provide me as much... (10 Replies)
Discussion started by: Dev_Dev
10 Replies

4. Shell Programming and Scripting

DB Access Command Line Utility

To read/write to a DB from Java or Perl, you usually have to install/reference several drivers and write a whole bunch of boilerplate DB access code. I'm curious if someone has written a command line utility for Unix/Linux for simple database access for the major providers, something like: ... (3 Replies)
Discussion started by: furashgf
3 Replies

5. Shell Programming and Scripting

Error using select menu command

Hi All, I am trying to use the select command & the menu. below mention is my script #!/bin/bash 2 3 PS3="Is today your birthday? " #PS3 system variable 4 5 echo "\n" 6 7 8 select menu_selection in YES NO QUIT 9 do 10 11 ... (1 Reply)
Discussion started by: milindb
1 Replies

6. Shell Programming and Scripting

How can i use a command that has a menu

I am a complete newbie to linux/unix so please be kind. I am trying to write a script to be used on a Buffalo terastation NAS. The terastation has a command "mfdisk" that is used for partition manipulation. I need to be able to use mfdisk in my script but the problem is it has a command menu... (2 Replies)
Discussion started by: Kain0o0
2 Replies

7. Linux

The dot command-line utility?

Hi, What else is the dot used beside relative filepaths in bash? Is it a shell utility as well? No man entry for dot (.)... (3 Replies)
Discussion started by: varelg
3 Replies

8. Programming

top command line utility

I'm writing a monitoring application. I'd like to periodically get the information provided by the 'top' command line utility from within my code and write the output of 'top' to a file. Wondering if anyone has already done something like this. Doing system("top > someFile"); does not create... (6 Replies)
Discussion started by: antoniomorandi
6 Replies

9. Programming

command line socket read utility

HI I have a messaging s/w daemon(TIBCO rvrd) provided by vendor which will accept connections from various clients and routes messages to the destinations. In order to route it internally uses two ports(one tcp adn one udp). I want to know on which port(tcp/udp) it is transmitting... (3 Replies)
Discussion started by: axes
3 Replies

10. Shell Programming and Scripting

Compound command with 'find' utility?

I'm trying to write a script using the 'find' command and it's -exec option to run a compound command against the files found. Example: find . -name "*.conf" -exec cat {} | grep "#" > /tmp/comments.list \; Of course the above doesn't work. So I experimented for a bit to see if there was... (6 Replies)
Discussion started by: deckard
6 Replies
Login or Register to Ask a Question