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
Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

From hardware perspective, every information system can be divided into three task areas Presentation, Application Logic and Data Storage. The R/3 Basis software is extremely s

Clustered file organization A clustered file is also called a B-tree-clustered file is a tree-structured file in which records with adjacent index values are clustered toget

Operating Systems have evolved tremendously in the last few decades. The first approach for building Operating Systems, taken during the 40s through early 60s, was to allow only on

what is network operating? explain about it design issues?

Process states in Linux OS Running:  Process is either ready to run or running Interruptible:  a Blocked part of a process and waiting for a signal or an event from anothe

Define entry section and exit section. The critical section problem is to design a protocol that the processes can use to cooperate. Every process must request permission  to e

Write a note on multithreading. Multithreading is the capability of an operating system to execute different parts of a program called as threads, at the same time. The program

When programming with threads, there are three very common mistakes that programmers often make: 1. locking twice (depending on the system and type of lock, can cause crashes, h

Can a direct access file be read sequentially? Explain. Yes. Keep a counter, cp, initially set to 0. After reading record cp, increment cp.