updated notes
This commit is contained in:
@@ -357,3 +357,34 @@ else
|
|||||||
echo "The file '$user_file' does not exist."
|
echo "The file '$user_file' does not exist."
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### for loop
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for i in 1..10; do
|
||||||
|
echo $i
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
### while loop
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
i=1
|
||||||
|
while [ $i -le 10 ]; do
|
||||||
|
echo $i
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
### until loop
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
i=1
|
||||||
|
until [ $i -gt 10 ]; do
|
||||||
|
echo $i
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user