# Bash में लूप्स — लिनक्स

Source: https://www.geekswithgeeks.com/hi/linux/linux-bash-loops

> दोहराए जाने वाले कामों के लिए for और while लूप्स।

## for लूप

मानों या फाइलों की सूची पर पुनरावृत्ति करें।

```bash
for f in *.txt; do
    echo "Found: $f"
done
```

Output:

```
Found: notes.txt
Found: todo.txt
```

## while लूप

तब तक चलता है जब तक इसकी शर्त सही रहती है।

```bash
count=1
while [ $count -le 3 ]; do
    echo "count: $count"
    count=$((count + 1))
done
```

Output:

```
count: 1
count: 2
count: 3
```

**Quiz:** `[ $count -le 3 ]` में `-le` का क्या अर्थ है?

- [ ] less than (कम)
- [x] less than or equal to (कम या बराबर)
- [ ] not equal (असमान)

*Answer:* less than or equal to (कम या बराबर). `-le` Bash का न्यूमेरिक "less than or equal to" टेस्ट ऑपरेटर है।
