bash:while_loop
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
bash:while_loop [2020/07/15 09:30] – external edit 127.0.0.1 | bash:while_loop [2021/01/26 12:08] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== BASH - While loo ====== | ||
- | |||
- | The while loop construct is used for running some instruction multiple times. | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | i=0 | ||
- | |||
- | while [ $i -le 2 ] | ||
- | do | ||
- | echo Number: $i | ||
- | ((i++)) | ||
- | done | ||
- | </ | ||
- | |||
- | So, the while loop takes the below form. | ||
- | |||
- | <code bash> | ||
- | while [ condition ] | ||
- | do | ||
- | commands 1 | ||
- | commands n | ||
- | done | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | </ | ||
- | |||
bash/while_loop.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1