Command substitution $( )
Captures the output of a command into a variable.
Syntax
result=$(command)
Description
The command inside $( ... ) runs and its output is substituted in its place.
Example
Loading editor…
Expected output
Today: 2026-10-04
When to use?
Embedding command output into a value/text.