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.





















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
Entry-sequenced file organization The records in an entry-sequenced file are store up in the order they are written into the file. New records are for all time appended to

What are batch systems? Early computers were physically huge machines run from a console. The general input devices were card readers and tape drivers. The common output device

What are kernels and what do kernels do? The kernel is a program that comprises the central core of a computer operating   system. It has entire control over everything that

When do we write a page from physical memory back to the disk? In general, caches have two broad types of writing policies. One approach is a write-through cache. In this case,

Explain Deadlock Prevention-Resource allocation graph allocation Resource allocation graph algorithm :  Using this algorithm we are able to actually know if there exists in th

Define Server Processing with Queues The efficient server processing of client request is essential for optimized client- server applications. This process is greatly enhanced

Q. Presume that the following processes arrive for execution at the times indicated. Every process will run the listed amount of time. In responding the questions use non pre-empti

Define I/O and CPU Bursts   Applications typically to through cycle of CPU bursts and Input/output bursts. Since the CPU sits idle during I/O operations, efficiency is improved

A hard-disk drive reads “120 GB HDD 7200 rpm 3 GB/sec transfer rate”. If the drive has a sector size of 512 bytes, what is the average rotational latency and transfer time to read

how to solve queing theory step by step