bash-command-substitution

JSON

rev 2  |  foxhop  |  1408638148000  |  JSON

rev 1
rev 2
4There are two ways:4There are two ways:
55
n61. wrap the command in "`":n6* wrap the command in "`":
77
n8   .. code-block:: bashn8 .. code-block:: bash
9   
10     myvar=`cat /etc/motd`
119
n121. wrap the command in "$()":n10  myvar=`cat /etc/motd`
1311
n14   .. code-block:: bashn12* wrap the command in "$()":
1513
tt14 .. code-block:: bash
15 
16     myvar=$(cat /etc/motd)16  myvar=$(cat /etc/motd)
rev 1  |  foxhop  |  1408634024000  |  JSON

empty
rev 1
tt1Bash Command Substitution
2#########################
3 
4There are two ways:
5 
61. wrap the command in "`":
7 
8   .. code-block:: bash
9   
10     myvar=`cat /etc/motd`
11 
121. wrap the command in "$()":
13 
14   .. code-block:: bash
15 
16     myvar=$(cat /etc/motd)