FAQ: Learn Bash Scripting - Loops


#1

This community-built FAQ covers the “Loops” exercise from the lesson “Learn Bash Scripting”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn the Command Line

FAQs on the exercise Loops

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

I didn’t understand any of this lesson. I had no idea what to do and all of the words didn’t make any sense. The only thing I finally understood was the solution, but that was after I had given up on the exercise. Given the little knowledge in programming that I have, how was I supposed to know how to do what the lesson was asking me to do?


#3

I agree, the lesson in no way explained nor gave an example on “how to” nest a conditional “if” statement within a while loop. It was inferred that running an echo command was no different than including an if conditional within the while loop. I don’t believe someone trying to learn Bash would “just” pick up on that.

This is problematic with tutorials, at least so I have found, where Bash, Linux etc are concerned. Sometimes programming as well, it is done in a way that is not very beginner friendly. There are terms and behaviors that do not always get very well defined.

Perhaps a better explanation of what loops are, how they work and how/when to use them would be beneficial before doing an exercise on nesting conditional within conditionals. It may also be nice to see an example of the nesting of one conditional into another before asking a novice to perform.

I have been a Linux user for years, written plenty of Bash scripts and to be quite honest the way this exercise was presented was a bit confusing.


#4

I agree with both of the above users. I have been scripting for a while now and the way these instructions are written would be very confusing for a beginner and just confusing in general. Unless you know about nesting if then statements into loops, this exercise will just be frustrating and make the user want to quit.