Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Linux Question Write a script called class.sh that takes two parameters as arguments. The first parameter is a file that contains a list of user

Linux Question

  1. Write a script called class.sh that takes two parameters as arguments. The first parameter is a file that contains a list of user names, one per line. The usernames contain only alphabetic characters and no white space. The second parameter is a user name. Your script should do the following:
  1. Determine that the correct number of arguments was received, or print a usage message and exit if not.
  2. Determine that the file with the name given as the first parameter exists, or print an error message and exit if not.
  3. Determine that the username is already in the file, and then either
    1. Print a message stating that the name already existed or,
    2. If the name was not in the file, then add the name to the end of the file.

Before you start writing your script, download and place the classlist.txt file into your home directory.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

=+13.5. Show of real functions f and g that f(w) + g(w)

Answered: 1 week ago

Question

politeness and modesty, as well as indirectness;

Answered: 1 week ago