~1 min read|
In the Terraform tutorials, the authors make use of a pattern I’d not seen before:
$ mkdir new-directory && cd $_
The end result is a new directory is created, and as might be expected, the directory is changed to the
How it works, however, is interesting.
$_expands to the last argument to the previous simple command or to previous command if it had no arguments.
For more on Command Expansion, see the Bash manual.
Otherwise, this post on parameter and command expansion from compciv.org is quite helpful for seeing other ways expansion can be used to great effect.
Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!