First page Back Continue Last page Overview Graphics
Control Structures, con't
for/in/do/done
For loop list whitespace separated (foreach in perl)
A C-like "for" is available but rarely used
Conditional control operators || and &&
- touch /etc/motd || echo "Error" >&2
- touch /etc/motd && echo "wrote to motd" >&2
Loops and branches can be nested as expected. Use whitespace and CRs to make your scripts look sane
More complex arithmetic and conditionals are allowed, but less used; see man bash, "let" command, "test" command help, etc.
Notes: