In Linux commands, characters such as $and & are illegal. What if I only want to display these special characters as common symbols? References are needed, and there are three ways to reference them in Linux.

  1. Use double quotation marks around “”, but this does not apply to “$”.

    echo “Today is $(date)”

  2. Enclose all special characters in single quotation marks.

    echo ‘Today is $(date)’

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

    echo “Today is $(date)”


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