DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Loops — Example 75

Quick explanation + ready code for: Loops.

Shell Loops Back to examples
Back to language
Syntax: Loops in Shell. ID: #75

Code

sum=0
for i in $(seq 1 17); do sum=$((sum+i)); done
echo $sum

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.