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
Determine an imperative statement Imperative statement points out an action to be carried out during execution of assembled program

How free-space is managed using bit vector implementation? The free-space list is implemented as a bit map or bit vector. Each block is shown by 1 bit. If the block is free, th

Differentiate between sequential access and direct access method?

Why is it not possible to enforce memory protection at compile time?   Every process should be protected against unwanted interference by other process, whether intentional or

what is multilevel page table and its applications?

What are threads? A thread is alike to sequential programs. Single threads have a beginning, sequence and end. At any given point in time during the runtime of the thread there

Q. The term "fast wide SCSI-II" signifies a SCSI bus that operates at a data rate of 20 megabytes per second when it moves a packet of bytes among the host and a device. Presume t

What is virtual memory? Virtual memory is a method that allows the execution of processes that might not be completely in memory. It is the separation of user logical memory fr

Define the Jobs which are admitted to the system for processing is called The Jobs which are admitted to the system for processing is known as long-term scheduling.

code for implementing NFU page replacement algorithm