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. Presume an operating system maps user-level threads to the kernel using the many-to-many model and the mapping is done through LWPs. Additionally the system allows developers to

What are Tree-structured directories We can generalize the directory structure to a tree of arbitrary height. This permits the user to create their own sub directories and to c

Q. Consider the demand-paged computer system where the level of multiprogramming is currently fixed at four. The system was recently deliberate to determine utilization of CPU and

Enhanced Second chance algorithm In this a modify bit is as well used. Now if the ordered pair of reference and modify is (0,0) neither recently used nor modified - the best

Q. What is Multiprogramming? Multiprogramming When two or more programs are in memory at the same instance, sharing the processor is referred to multiprogramming opera

Determine the syntax of the assembler directive EQU The following is syntax of the assembler directive EQU: EQU

What is critical section problem? Consider a system consists of 'n' processes. Every process has segment of code called a critical section, in which the process might be changi

Explain segmentation hardware? We define an completion to map two-dimensional user-defined addresses into one-dimensional physical addresses. This mapping is affected by means

LOOK o Like SCAN except stops moving inwards (or outwards) when no more requests in that direction exist. C-SCAN (circular scan) o Moves inwards servicing requests u

Android operating system is an open source, Linux-based Smartphone OS. It is the world's most popular mobile platform with more than 700,000 applications and 25 billion downlo