Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

UNIX OS users.ref file content: albert.jonathan Albert Jonathan elena.needham Elena Needham chris.kalambayi Chris Kalambayi alseny.diallo Alseny Diallo karmandeep.bassi Karmandeep Bassi derek.behunin Derek Behunin ryan.campbell3 Ryan

UNIX OS

"users.ref" file content:

albert.jonathan Albert Jonathan elena.needham Elena Needham chris.kalambayi Chris Kalambayi alseny.diallo Alseny Diallo karmandeep.bassi Karmandeep Bassi derek.behunin Derek Behunin ryan.campbell3 Ryan Campbell3 david.santos2 David Santos2 quang.phan2 Quang Phan2 rachel.hohler Rachel Hohler dylan.holmes Dylan Holmes

For the following steps, write shell programs that use command line arguments as input to the shell program. Do not prompt the user for input from the keyboard! Note: Most of these shell programs need to be only 1 or 2 lines long.

Write a shell program called list to display all the usernames and full names in the users.ref file. The information should be displayed in alphabetical order by student's last name (not by username). Save the list shell program in your lab7 directory.

Write a shell program called find to locate an existing record in users.ref and display the student's username and full name on the screen. The search should not be case sensitive. This shell program should allow the user to specify either a student's username or their full name. Save the find shell program in the lab7 directory.

 $ find "lily.brown" or $ find 'Lily Brown'
 

Did you encounter any problems in the previous step? If so, what were they and how did you resolve them? Include a note describing the problems and solutions in a file called lab7.notes.

Write a shell program called remove which deletes a student's entry from your users.ref file. Similar to find, the user should be able to specify the student to be removed by their username or their full name. Save the remove shell program in lab7. (hint: grep has an option "-v". Go check it out!)

Write a shell program called add to add a new username and full student's name to your users.ref file. Your program should be used in the following manner (hint: echo hello >> file):

$ add woody.brown 'Woody Brown'
 

Part II:

Verify correct operation of your shell programs. Use the script command to record your test results. Type script at the command line. This will start a new shell that "captures" all input and output and records it in a file named typescript in your current directory.

Execute the pwd command.

Execute the ls command.

Execute your list command.

Execute your find command (or whatever you named it) twice. (Once to locate a student by their username and a second time to locate them by their full name.)

Use your remove shell program twice: once to remove a student using their username, another removing them by their full name.

Use your add shell program to add an entry to the file

Execute your list command a second time.

Type exit (or ctrl-d) to exit the script shell. The input and output were written to a file called typescript. Change the name of this file to script1 and save it in the lab7 directory.

Part Ill:

Use the "tar" (tape archive) command to wrap all the files into a single file, and then send only that file to lliang via mailx . The files to wrap with the tape archive are your final versions of:

list

find

remove

add

lab7.notes

script1

Copy all of the final versions of your shell programs into your lab7 directory. Then use the following tar command to create your archive:

 tar cvf lab7.tar lab7

Be sure to include the latest version of each of your files! Move lab7.tar to a temp directory. Try the following command to confirm you have included everything tar xvf lab7.tar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago