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.


#5

I’d also agree with this sentiment. This is a nice Bash refresher, but this would be extremely tough without some Linux and Bash knowledge already ingrained. The if statement provided in this lesson does not even provide indentation which will increase confusion.

Similarly, I’m not sure how the answers are being calculated. It does not look to be comparing STDOUT in the terminal, as my results are the expected output yet the solution states it’s incorrect. It’s a nice start but these could be fine tuned some.


#6

I have to agree with everything that has been stated. I want to be able to apply what I have learned in real-life situations. Understanding conditions, loops and how they work is important to writing meaningful scripts. Not to mention, they lay the ground work when utilizing them in other programming languages. This lesson needs to be reviewed and adjusted from a Beginner perspective.


#7

Just wanted to add my voice to the group of people stating their confusion and frustration at this exercise. I managed to complete it, but I have no idea what I just did and why.

Compared to the Python 3 course, the Command Line course feels like an afterthought and the way some lessons are laid out are weird as heck. The instructions will ask you to write and run some commands without knowing what they are or what they do, THEN they will explain what you have just done. Wouldn’t it be better to begin by explaining some basic principles, asking the user to perform the task and then review the material again to make sure it sinks in properly?


#8

My thoughts exactly. Before starting Python3, I had absolutely no coding experience, but was eventually able to figure everything out even if i had to restart a lesson. With the command line lessons, I always have to do them twice and still do not feel I am getting enough repetition for all the the concepts to stick long term.
My goal is to be able to use what I learn in a conversation with the computer, not to buzz through a course “by the end of the semester.”
Maybe our feedback will alter the design of the CLI course


#9

Super NOT impressed with this particular lesson. Way too much assumed by the writers on what the users know/don’t know about CLI.


#10

Lesson 4 of 7, Bash Scripting Loops

I think I had the correct solution on my own. I just wish I had copied my solution prior to asking for the solution so I could compare the two.

Funny (bug?) when I ran the script, I think the output was wrong. It prints the first greeting and then the second greeting twice (three lines in total).


#11

I 100% agree with this. I’ve been staring at this lesson for days and with no prior knowledge of programming before the Python 3 course, and this is extremely confusing for me.