Loops in Bash
- In programming,We need to repeat certain steps for number of times.
- We can't repeat the statement or copy paste the code.
- To do such thing loops where used.
- It is used to repeat certain steps for number of times until the condition given gets failed.
- There are three loop statement in bash:
- while loop
- until loop
- for loop
While loop :
Until loop :
- The until loop work in the reverse principle of while loop.
- It execute the statement in the loop until the statement is false.
- Once it reaches true,the loop terminates.
- Syntax:
For loop:
No comments:
Post a Comment