Linux commands are illegal characters like $, &. What if you only want to display these special characters as normal symbols in your commands? You need to use references, and there are three of them in Linux.

  1. Enclosed in double quotation marks “”, but this is not valid for “$”.

    echo “Today is $(date)”

  2. Enclosure of all special character functions by single quotation marks “”.

    echo ‘Today is $(date)’

  3. Backslash \ escape, which is common in many situations.

    echo “Today is $ (date)”

Output:

[root@localhost ~]# echo "Today is $(date)" Today is Thursday, July 01, 2021 20:27:00 CST [ring ~]# echo 'Today is $(date)' Today is $(date) [root@localhost ~]# echo "Today is \$(date)" Today is $(date)