Command substitution
Feb. 8th, 2018 03:52 pmSuppose you want do a thing which needs a directory, and you want to pass it the current directory.
In Bash and other similar shells, you can say something like:
At the Windows command pompt, you can kind-of do that.
In Bash and other similar shells, you can say something like:
doThing $(pwd)The dollar-bracket bit is replaced with the output of the command in the brackets.
At the Windows command pompt, you can kind-of do that.
for /f "tokens=*" %G in ('cd') do \@doThing %GIt's not exactly the same. If the command in brackets produces multiple lines, the Windows version will do the thing once per line. The Bash version will do the thing once with lots of params.