Question: When you have tasks that need to be completed, multiple tasks with data coming in from files or other sources, loops are a great option.

When you have tasks that need to be completed, multiple tasks with data coming in from files or other sources, loops are a great option. Loops work on either the 'do something until you're done' or 'keep doing this while there is still data' idea. Typically While/Until loops, which are essentially the same, are done when you don't know the number of iterations. For loops are used when you do know the number of iterations but it's a lot.
Write a BASH loop script that will do the following IN ORDER as they are written:
Use VIM to create a BASH script named 'loop.sh' in your /home//scripts/ directory
Add a header to the script that shows the following information:
* Script Name: loop.sh
* Author: Your Name
* Last Edited: date of last modification
* Purpose: a simple synopsis of the script's purpose and what it does
You can choose to use a while, until, or for loop...that's your choice
Create a file named 'friends.txt' in your /home//scripts/ directory. That 'friends.txt' file should contain the names of 5 of your friends...first names only please. They each need to be on a separate line such as:
John
Susan
Larry
Melissa
Cameron
Create a loop that will open the friends.txt file and, line by line, echo out the names listed. Each output line from the script should add a "Name: " prefix to each line. What I mean by that is your output, after you run the script should be:
Name: John
Name: Susan
Name: Larry
Name: Melissa
Name: Cameron
You will need to save your script, make it executable, then run it. Here's what you'll be submitting to Moodle for grading. Please make sure your follow the instructions here when capturing your screenshot.
Clear your terminal screen
Open your completed script in VIM so the entire script is visible.
Capture a screenshot using the TealVirt 'Capture Screenshot Package' option of your script (loop.sh) code. Be sure to show all of the code, including the header and any comments you add to make it readable. Upload that screenshot as in PDF format.
Upload the PDF screenshot package to Moodle here for grading. I cannot stress enough, don't wait until the last minute to complete these assignments. Things happen and technology breaks. I can help you solve problems as long as they don't occur the day or evening before the assignments are due.

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!