How is that better than
bash or zsh:
for i in `seq 1 100`; do echo $i; done
zsh: for i in `seq 1 100`; echo $ibash or zsh:
for i in `seq 1 100`; do echo $i; done
zsh: for i in `seq 1 100`; echo $irc really shines when you have problems that in bash or zsh would suggest using multiple layers of expansion. The semantics of rc's expansion is much less thorny.
I prefer real examples - here, why not just write
seq 1 100
- what is the loop for? And shell loops can frequently (always, if you are willing to write helper scripts) be replaced with xargs, which tends to be very much faster, e.g. seq 1 100 | xargs echo
(which doesn't quite give the same output, but passing -n1 to xargs fixes that)+1 for rc.
I mean, what about [[ ]] vs. (( )) vs. [ ]? Or the beginning of a case statement? Those always get me since I don't use them often enough for them to stick.
% which \[
/usr/bin/[
All of the other syntax is shell-specific (run via built-ins), so that can vary, and be a little more obtuse.[1] Albiet with some minor differences:
% if [ -d /tmp ]; then echo "TRUE"; fi
TRUE
% if test -d /tmp ]; then echo "TRUE"; fi
test: too many arguments
% if test -d /tmp; then echo "TRUE"; fi
TRUE
% diff /usr/bin/{test,\[}
Binary files /usr/bin/test and /usr/bin/[ differ
% man \[
No manual entry for [ $ 9 man rc | wc -l
496
$ man bash | wc -l
4890
Fewer interactive features as well, unfortunately. But it's small enough to keep in your head, and I find that makes it far more pleasant to use.