by dietr1ch · 5y ago · 0 comments
The fact that I can write a simple for loop without needing to look up how to do it by far beats the POSIX compatibility, if I need it I can still write a bash script, but when using the shell I don't need to recall where semicolons or `do`, brackets (and how many) go.
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}Did the same, but moved on.
Now it is: bash => zsh => fish => nu