Question: in bash scripting in ubunto 18.04 Write a script called class.sh that takes two parameters as arguments. The first parameter is a file that contains

in bash scripting in ubunto 18.04

  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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!