a BASH script PUSH-UP counter (for #gains )
About this video
In Bash episode 5, NetworkChuck teaches loops by building a push-up counter script. He starts with a while loop: a variable x starts at 1, the loop runs while x is less than or equal to 100, echoing the count and incrementing x with ((x++)) between do and done. He then replaces the echo with a read prompt so the user must press Enter for each rep, lowering the target to 10. Other while examples include reading a file line by line (the full text of Hamlet, which he says runs to 5,566 lines) and a warning: while true creates an infinite loop stopped only with Ctrl+C. He covers until loops as the inverse, looping until a variable equals ‘coffee’ in a coffee-or-tea prompt example. For loops iterate over a list: a cups variable takes each value 1 through 10, written as a list or a {1..10} range; a for loop over website names combined with an if/ping test reports each domain up or down; and a for loop over cities in a text file curls wttr.in to print each city’s weather. Finally he explains break and continue: a while-true uptime checker pings a target every two seconds and breaks once it responds, while an elevator example uses continue to skip floor 13.
Key takeaways
- A while loop repeats between do and done while its condition is true; increment the counter inside or it never ends
- While true is an infinite loop; Ctrl+C stops it, and break is the controlled way to exit such a loop
- An until loop is the inverse of while: it runs until its condition becomes true
- A for loop assigns each item in a list, range like {1..10}, or command/file output to its variable in turn
- Continue skips only the current iteration, as in the elevator example that skips floor 13
Episode details: published August 24, 2022 · 21:07 long. Summary written by Self Growth Videos from the episode itself. Business results and any income figures mentioned are NetworkChuck’s own claims, shared for education — they are not typical or guaranteed.
← Previous: you need to learn SQL RIGHT NOW!! (SQL Tutorial for Beginners) · Next: build a meme Python website (Flask Tutorial for Beginners) →
All NetworkChuck videos · NetworkChuck profile · NetworkChuck on YouTube





