Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please answer using linux. THE ANSWER I HAVE BEEN RECEVING IS NOT WHAT IM LOOKING FOR. thank you ! 1. Switch to a command-line terminal

Please answer using linux.

THE ANSWER I HAVE BEEN RECEVING IS NOT WHAT IM LOOKING FOR. thank you !

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the ter- minal using the user name of root and the password of LNXrocks!. 2. At the command prompt, type vi myscript2 and press Enter to open a new file for editing called myscript2 in your home directory. 3. Enter the following text into the myscript file. When finished, save and quit the vi editor. #!/bin/bash echo e "This program adds entries to a family database file. " echo e "Please enter the name of the family member -->\c" read NAME echo e "Please enter the family members relation to you (i.e. mother) - ->\c" read RELATION echo e "Please enter the family members telephone number -->\c" read PHONE echo e "$NAME\t$RELATION\t$PHONE" >> database 4. At the command prompt, type chmod u+x myscript2 and press Enter. Next, type ./myscript2 at the command prompt and press Enter. Answer the questions with information regarding one of your family members. 5. At the command prompt, type cat database and press Enter. Was the entry from Step 4 present? Why?

6. Perform Step 4 several times to populate the database file with entries.

7. At the command prompt, type vi myscript2 and press Enter. Edit the text inside the myscript2 shell script such that it reads: #!/bin/bash echo e "Would you like to add an entry to the family database file? " read ANSWER1 if [ $ANSWER1 = "y" o $ANSWER1 = "Y" ] then echo e "Please enter the name of the family member -->\c" read NAME echo e "Please enter the family members relation to you (i.e. mother)- ->\c" read RELATION echo e "Please enter the family members telephone number -->\c" read PHONE echo e "$NAME\t$RELATION\t$PHONE" >> database fi echo e "Would you like to search an entry in the family database file? " read ANSWER2 if [ $ANSWER2 = "y" o $ANSWER2 = "Y" ] then echo e "What word would you like to look for? -->\c" read WORD grep "$WORD" database fi 8. At the command prompt, type ./myscript2 and press Enter. When prompted to enter an entry into the database, choose y and press Enter. Answer the questions with information regarding one of your family members. Next, when prompted to search the database, answer y and press Enter. Search for the name that you just entered a few seconds ago. Is it there? 9. At the command prompt, type ./myscript2 and press Enter. When prompted to enter an entry into the database, choose n and press Enter. Next, when prompted to search the database, answer y and press Enter. Search for a name that you entered earlier in Step 6. Was it there? Why? 10. At the command prompt, type vi myscript2 and press Enter. Edit the text inside the myscript2 shell script such that it reads: #!/bin/bash echo e "What would you like to do? Add an entry (a) Search an entry (s) Enter your choice (a/s)-->\c" read ANSWER case $ANSWER in a|A ) echo e "Please enter the name of the family member -->\c" read NAME echo e "Please enter the family members relation to you (i.e.mother)- ->\c" read RELATION echo e "Please enter the family members telephone number -->\c" read PHONE echo e "$NAME\t$RELATION\t$PHONE" > > database ;; s|S ) echo e "What word would you like to look for? -->\c" read WORD grep "$WORD" database ;; *) echo "You must enter either the letter a or s." ;; esac

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started