I think I'll add it in a revision.
I also agree on bash being quirky. I tell my class that the gold standard is a bash script that works 99% of the time.
Things like 'while read -r line; do {stuff with $line}; done'
These idioms have issues for their most common uses (e.g. dealing with filenames with embedded newlines), but they do work 99% of the time.
find . -type f -name foo -print0 | while read -rd ''; do
grep -l bar "${REPLY}"
done
find separates its output with the NUL byte when you do -print0, and -d '' means read NUL-separated input.Of course, in this case it would be better to use:
find . -type f -name foo -print0 | xargs -0 -I{} grep -l bar '{}'
but if you've got several things to do for each file, the first one makes sense (or you can put those several things in a script, and use xargs).If your guide is for bash and not sh, then I would say don't teach them [, just do [[. It's safer, since it won't glob or split words, you don't need quoting, and you don't need to escape operators like < and >. Maybe it's can be seen as more difficult since it's a sublanguage (doesn't use the regular syntax rules), but so are (( and $(( which you've discussed at length, and which are typically less useful than [[ in bash.
[0]: http://search.cpan.org/~toddr/IPC-Run-0.92/lib/IPC/Run.pm
https://github.com/yesodweb/Shelly.hs/blob/master/README.md#...
That said, I try not to do bash scripting. It's always been a boiling-the-frog thing for me: You start with a cute script with a couple of lines and then you make it more robust and add some more stuff and before you know, you've written a non-trivial program in an awfully quirky programming language.
But I'm still happy I've been there and know my way around bash fairly well. Makes for some pretty powerful quick one liners.