Write a linux script to add name in class list, Operating System

For this exercise I wanted to give you some real-world examples of useful bash scripts. Therefore, you will write a couple of scripts that I actually use in my teaching to automate clerical tasks. To begin, please copy this (ficitious) classlist.txt to your directory, and note that it contains a list of usernames.

bholly

bjones

bscott

dgatton

dhathaway

jbonham

jcroce

jdenver

jhendrix

jjoplin

jmorrison

kcobain

mhutchence

oredding

pcline

rbuchanan

rrhoads

rwaters

svaughan

wwilliams

Write a script called addnames that is to be called as follows, where classlist is the name of the classlist file, and username is a particular student's username.

./addnames classlist username

The script should

1. print a message stating that the name already existed, or

2. add the name to the end of the list.

 Hint: Use a for-loop to process each line in the file. To create a list of lines in the file, remember that you can use any bash construct inside a script that you can use in the terminal window. How would you list the lines of the file in the terminal window? Similarly, how would you append a particular item to the end of an existing file from the terminal window?

Posted Date: 3/20/2013 1:52:45 AM | Location : United States







Related Discussions:- Write a linux script to add name in class list, Assignment Help, Ask Question on Write a linux script to add name in class list, Get Answer, Expert's Help, Write a linux script to add name in class list Discussions

Write discussion on Write a linux script to add name in class list
Your posts are moderated
Related Questions
Q. Why is it significant to balance file system I/O among the disks as well as controllers on a system in a multitasking environment? Answer: A system can perform mere

Write a short note about schedulers. Processes migrate between the various scheduling queues throughout its life time. The operating system should select for scheduling purpose

Question: a) What is an Input/Output module and what are the five categories their functions fall into? b) What is an Operating System? Briefly describe the two objectives

Problem: Managing Outside Communication. a. What is the principal action we use when communicating through a web browser? b. Give an example of how to preaddress an email

what is difference between file descriptor and file pointer?

What is a semaphore? A semaphore 'S' is a synchronization tool which is  an integer value that, apart from initialization, is accessed only by two standard atomic operations; w

What is Multiprogramming? Multiprogramming is the capability of am operating system to support multiple applications running concurrently. Multiprogramming simply means that an

Q. We have stressed the require for an operating system to make efficient use of the computing hardware. When is it suitable for the operating system to forsake this principle and

Define the Communications Techniques - Application interaction protocols    Communications techniques are well defined. They give developer the programmatic mechanism to transf

LRU evicts the page which was last accessed the farthest into the past of any page resident in physical memory, i.e. the least-recently used page. LRU approximates OPT when the rec