There are two ways to capture the output of command line in bash
:
Legacy Bourne shell backticks ``
:
var=`command`
This is a legacy question, but I came up with a perfectly valid example of $(...)
over `...`
.
I was using a remote desktop to windows running cygwin and wanted to iterate over a result of a command. Sadly, the backtick character was impossible to enter, either due to the remote desktop thing or cygwin itself.
It's sane to assume that a dollar sign and parentheses will be easier to type in such strange setups.