$() in Linux Shell Commands?
chmod 777 $(pwd)
It's very similar to the backticks ``.
It's called command substitution (posix specification) and it invokes a subshell. The command in the braces of
Unlike the backticks, the
There are aso differences in escaping characters within the substitution. I prefer the
In POSIX or POSIX-like shells (
should be replaced with:
to avoid word-splitting and filename generation on the current working directory path.
Or even better (except under some shells, like zsh, in case the directory has been renamed):
Or even better: