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

Loops — Example 73

Quick explanation + ready code for: Loops.

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

Code

sum=0
for i in $(seq 1 13); 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.