Here is an example while loop in Linux / bash
i=0
while [ $i -lt 100 ]; do
echo The counter is $i
let i=i+1
done
Example output:
developer@codetryout:~$ while [ $i -lt 100 ]; do
> echo The counter is $i
> let i=i+1
> done
The counter is 0
The counter is 1
The counter is 2
The counter is 3
The counter is 4
The counter is 5
The counter is 6
The counter is 7
The counter is 8
The counter is 9
The counter is 10
The counter is 11
The counter is 12
The counter is 13
The counter is 14
The counter is 15
The counter is 16
The counter is 17
The counter is 18
The counter is 19
The counter is 20
The counter is 21
The counter is 22
The counter is 23
The counter is 24
The counter is 25
The counter is 26
The counter is 27
The counter is 28
The counter is 29
The counter is 30
The counter is 31
The counter is 32
The counter is 33
The counter is 34
The counter is 35
The counter is 36
The counter is 37
The counter is 38
The counter is 39
The counter is 40
The counter is 41
The counter is 42
The counter is 43
The counter is 44
The counter is 45
The counter is 46
The counter is 47
The counter is 48
The counter is 49
The counter is 50
The counter is 51
The counter is 52
The counter is 53
The counter is 54
The counter is 55
The counter is 56
The counter is 57
The counter is 58
The counter is 59
The counter is 60
The counter is 61
The counter is 62
The counter is 63
The counter is 64
The counter is 65
The counter is 66
The counter is 67
The counter is 68
The counter is 69
The counter is 70
The counter is 71
The counter is 72
The counter is 73
The counter is 74
The counter is 75
The counter is 76
The counter is 77
The counter is 78
The counter is 79
The counter is 80
The counter is 81
The counter is 82
The counter is 83
The counter is 84
The counter is 85
The counter is 86
The counter is 87
The counter is 88
The counter is 89
The counter is 90
The counter is 91
The counter is 92
The counter is 93
The counter is 94
The counter is 95
The counter is 96
The counter is 97
The counter is 98
The counter is 99
developer@codetryout:~$
This is an example script for shell script bash, while loop