Question: CPT 180 BashAssignment Directions Using the following guidelines, create a Bash program. 1. You will be using the CPT180Stuff folder from Chapter 8 for this

CPT 180 BashAssignment

Directions

Using the following guidelines, create a Bash program.

1. You will be using the CPT180Stuff folder from Chapter 8 for this assignment.

2. Create a Bash program named workWithFiles3.sh

3. Add three comment lines at the top of the program that contain:

a. Program Name

b. Program Description

c. Programmer's Name (You)

4. Write code that will do the following:

a. Using an if statement, determine if both the dognames.txt file and the catnames.txt file exist. If both files exist, the program should complete steps b e below. If either file does not exist, the program should print out the message "Unable to access one or more files".

b. Print the contents of the dognames.txt file.

c. Print the contents of the catnames.txt file.

d. Add two cat names to the catnames.txt file. You can pick the names. The example output below shows the names Sassy and Lucy added.

e. Print the contents of the catnames.txt file.

5. Submit the workWithFiles3.sh file into the Bash Assignment Submission Folder.

Hints

1. The echo command when used to append to a file adds a newline after the item is appended.

2. When using Cygwin, you can access the Windows drives by using the cygdrive device. For example, if your CPT180Stuff folder is located in the root directory of the E drive, you could access the dognames.txt file from your Bash program by using the path:

/cygdrive/e/cpt180stuff/pets/dogs/dognames.txt

Example Output

 CPT 180 BashAssignment Directions Using the following guidelines, create a Bash

My files are located in the following respectively:

C:\cpt180Stuff\cpt180Stuff\pets

C:\cpt180Stuff\cpt180Stuff\pets\dogs

C:\cpt180Stuff\cpt180Stuff\pets\dogs\dognames.txt

C:\cpt180Stuff\cpt180Stuff\pets\cats

C:\cpt180Stuff\cpt180Stuff\pets\cats\catnames.txt

I have the PDF that I am supposed to create the code with available upon request.

chuck@DESKTOP-SNI6U89 $ ./workwithfiles3.sh Spot Max Lassie Rover Snoopy Misty Felix Fluffy Kimba Tom Mortimer Tigger Misty Felix Fluffy Kimba Tom Mortimer Tigger Sassy Lucy chuck@DESKTOP-SNI6089 $

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!