|
|
| There are two ways: | | There are two ways: |
| | | |
| n | 1. wrap the command in "`": | n | * wrap the command in "`": |
| | | |
| n | .. code-block:: bash | n | .. code-block:: bash |
| | | |
| myvar=`cat /etc/motd` | | |
| | | |
| n | 1. wrap the command in "$()": | n | myvar=`cat /etc/motd` |
| | | |
| n | .. code-block:: bash | n | * wrap the command in "$()": |
| | | |
| t | | t | .. code-block:: bash |
| | | |
| myvar=$(cat /etc/motd) | | myvar=$(cat /etc/motd) |
|
|
| t | | t | Bash Command Substitution |
| | | ######################### |
| | | |
| | | There are two ways: |
| | | |
| | | 1. wrap the command in "`": |
| | | |
| | | .. code-block:: bash |
| | | |
| | | myvar=`cat /etc/motd` |
| | | |
| | | 1. wrap the command in "$()": |
| | | |
| | | .. code-block:: bash |
| | | |
| | | myvar=$(cat /etc/motd) |