Member-only story
Linux — Shell Scripting/Loops
The purpose of this hands-on training is to teach you how to use loops in the shell.
Learning Outcomes
At the end of the this hands-on training, you will be able to;
- explain loops in shell.
- use while loops in shell scripting
- use until loops in shell scripting
- use for loops in shell scripting
- use continue and break statements in shell scripting
- use select loops in shell scripting
Outline
- Part 1 — While loops
- Part 2 — Until loops
- Part 3 — For loops
- Part 4 — Continue and Break Statements
- Part 5 — Select loops
Part 1 — While loops
- When writing programs in shell, in some cases it is not enough to execute our block of code only once. The loops are used to repeat (iterate) the execution of a block of code.
- while loops have a boolean logic, similar to if statements. As long as the result of the condition returns True, the code block under while loop runs. When the condition returns to False, the loop execution is terminated and the program control moves further to the…







