CPT 180 Bash Assignment 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...

1 answer below »
These 2 assignments are for bash script and powershell. The bash has to be done first using the CPT180Stuff folder that is attached with the instructions. The powershell will use the CPT180Stuff folder that was saved from the bash program.


CPT 180 Bash Assignment 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 Hints for the bash script Posted Jul 16, 2020 11:00 AM I know the script is a little way off, but a couple of comments. First, you are using a completely different scripting language. Make certain you read up on bash before you start. Most students do well if they got the logic for appending the names to the catnames.txt file. The bash script is just that but using the bash shell rather than Python. Be certain you use the same directory structure for this script, e.g. /cpt180stuff/pets/cats/. Don't write a script that assumes the files are somewhere else. Make certain you check for the existence of BOTH the dognames and catnames files. This was a requirement for the chapter 8/9 assignment; it is the same for the bash assignment. Bash is really picky about spaces in an if-statement. If you are getting errors on your if, make certain the braces have spaces before and after. Don't forget to print the contents of the catnames file both before and after you have appended the names. A lot of students miss that for some reason. Good luck. CPT 180 PowerShell Assignment Directions Using the following guidelines, create a python program. 1. You will be using the CPT180Stuff folder from the Bash Assignment for this assignment. 2. Create a PowerShell program named workWithFiles4.ps1 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 – h below. If either file does not exist, the program should print out the message "Unable to access one or more files". b. Get the contents of the file named dognames.txt in the CPT180Stuff\pets\dogs folder. c. Print the contents of the file. d. Get the contents of the file named catnames.txt in the CPT180Stuff\pets\cats folder. e. Print the contents of the file. f. Add two cat names to the catnames.txt file. You can pick the names. The example output below shows the names Sammy and Luna added. g. Get the contents of the file named catnames.txt. h. Print the contents of the file. 5. Submit the workWithFiles4.ps1 file into the PowerShell Assignment Submission Folder. Hints 1. The PowerShell Add-Content command adds a newline by default. Example Output
Answered Same DayJul 22, 2021

Answer To: CPT 180 Bash Assignment Directions Using the following guidelines, create a Bash program. 1. You...

Sanghamitra answered on Jul 24 2021
139 Votes
cpt180Stuff/cars/familycars/familycars.jpg
cpt180Stuff/cars/familycars/familycars.txt
Chevrolet Impala
Honda Accord
Ford Taurus
Kia Optima
Voltswagon Jetta
Chrysler 300
cpt180Stuff/cars/sportscars/sportscars.jpg
cpt180Stuff/cars/sportscars/sportscars.txt
Ford Mustang
Chevrolet Corvette
Pontiac GTO
Oldsmobile 442
Porsche 911
Dodge Charger
cpt180Stuff/cpt-180-bash-assignment-vjtj2lth.pdf
CPT 180 Bash Assignment
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...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here