by macromagnon · 5y ago · 0 comments
for i in $(seq 1 10)
do echo $i
done
Then you can just replace new lines with ; if writing a one liner. for i in $(seq 1 10); do echo $i; done
I guess it isn't as simple as python for i in range(10): print(i)
but it's pretty close aside from the variable binding. for i in {1..10}; echo $i
to me is as clear as the python version.
Very compact and useful for one liners. for i in {1..10}