LordSilver:
When you do commands like docker rm $(docker ps -aq)
, how do you call the $( )
part?
Alistair Mackay:
$()
creates a sub-shell to run the command in the brackets, and captures the output such that you can feed that output to another command. It is a very powerful technique in bash and other similar shells.
docker rm $(docker ps -aq)
- will be interpreted like so
- Execute
docker ps -aq
- Execute
docker rm
using the output of #1 as the argument - i.e. the container(s) to remove