Languages
[Edit]
EN

Bash - while loop

0 points
Created by:
Teilsa
345

This article will show you how to use the while loop in Bash.

Syntax:

#!/bin/bash

while : 
do 
    echo "Hello"
done

 

Practical example

#!/bin/bash

i=0
while ((i < 5))
do
    echo $((i++))
done

 Output:

0
1
2
3
4

Infinite loop

#!/bin/bash

while : 
do 
    echo "Hello"
done

 Output:

Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
...

Bash

Bash - while loop
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join