Skip to content

Details

We made it to the examples last month, so we'll start going through them
and some bonus material this Thursday at 19:00.
----
Abstract
Order matters when the shell executes a command, but isn't
strictly left to right. Redirects, functions, sub-shells,
{brace,tilde,parameter,variable,arithmetic} expansion, pipes, globbing,
regular expressions, command substitution and more.
What order does bash evaluate the different parts of the command line and
what effect does that ordering have on the command? Which portions of the
command are evaluated by the shell and which aren't?
The presentation will use command line examples to illustrate evaluation
order for the various parts of a command.
For example:
grep foo file.txt >file.txt
That command results in file.txt being empty regardless of what the
previous contents were ( provided file permissions allow the user to write
to file.txt ). The reason is that the shell truncates file.txt before even
starting up grep, so grep is actually searching a newly truncated and
empty file.

You may also like