Hi,
Any thing enclosed in $( ) will be treated as command to execute.
$( ) is same as enclosing in back quotes ` `
Lets take this example
Here hostname inside echo is just treated as text to be displayed.
Code:
[user@CDC ~]$ echo "Host name is hostname"
Host name is hostname
In the below command hostname in echo command is a command. In order to execute it under echo, we need to enclose it under $( ) or ` `
Code:
[user@CDC ~]$ echo "Host name is $(hostname)"
Host name is CDC
# this is also same
[user@CDC ~]$ echo "Host name is `hostname`"
Host name is CDC