eolas/Programming_Languages/Shell/Loops_in_bash.md

28 lines
305 B
Markdown
Raw Normal View History

2023-02-04 09:26:34 +00:00
---
categories:
- Programming Languages
tags:
- shell
---
# Loops in bash
2023-03-05 08:02:49 +00:00
## Loop through an array
2023-02-04 09:26:34 +00:00
```bash
for element in "${arr[@]}"
do
echo "$element"
done
```
2023-03-05 08:02:49 +00:00
## Traditional for loop with upper and lower increment range
```bash
for (( i=0; i<=5;i++ )); do
echo $i
done
# 1 2 3 4 5
```