vault backup: 2024-05-30 18:26:46
This commit is contained in:
parent
394f6fe482
commit
a38896f0af
@ -71,6 +71,8 @@ goodbye)
|
|||||||
esac
|
esac
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If using `tes`
|
||||||
|
|
||||||
## Loops
|
## Loops
|
||||||
### For loops
|
### For loops
|
||||||
`for` loops are used when you have a finite collection over which you want to iterate, such as a list of files, or a list of server names:
|
`for` loops are used when you have a finite collection over which you want to iterate, such as a list of files, or a list of server names:
|
||||||
@ -86,7 +88,14 @@ for i in {1..10} ; do ... ; done
|
|||||||
```
|
```
|
||||||
### While loops
|
### While loops
|
||||||
`while` loops operate on lists of unknown size. It will keep running until the `test` it evaluates returns false:
|
`while` loops operate on lists of unknown size. It will keep running until the `test` it evaluates returns false:
|
||||||
|
```bash
|
||||||
|
i=0
|
||||||
|
while [ $i -lt 10 ]; do
|
||||||
|
echo $i
|
||||||
|
i=$(( $i + 1))
|
||||||
|
done
|
||||||
|
echo “Done counting”
|
||||||
|
```
|
||||||
### While loops
|
### While loops
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
Loading…
Reference in New Issue
Block a user