Dollar character before double quotes in Bash

前端 未结 1 862
南旧
南旧 2020-12-11 19:26

I recently read some bash code, echo $\"asdf\", what is $ for?

What is the difference between $\"asdf\" and just \"asdf

1条回答
  •  不知归路
    2020-12-11 19:37

    As documented in the bash manual, it is used for localization:

    A double-quoted string preceded by a dollar sign (‘$’) will cause the string to be translated according to the current locale. If the current locale is C or POSIX, the dollar sign is ignored. If the string is translated and replaced, the replacement is double-quoted.

    0 讨论(0)
提交回复
热议问题