0

bash中的''与$''

 2 years ago
source link: https://www.lujun9972.win/blog/2021/05/17/bash%E4%B8%AD%E7%9A%84''%E4%B8%8E$''/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
bash中的''与$'' - 暗无天日

bash中的''与$''

之前我一直以为bash中的单引号字符串中是可以通过反斜线(\)来转义单引号的,但是通过查阅 bash manual 发现这是我的错觉。

bash中的单引号字符串('xxxx')会 完全 保留字符的字面意义,单引号是无法包含在其中,反斜杠在单引号字符串中表示的就是反斜杠,而不是转义符号。

如果想要引用单引号(')需要使用 $'xxxx' 这种格式,它会尽可能保留字符字面意义的情况下支持通过反斜杠(\)进行转义。

2021-05-17 2021-05-17 linux和它的小伙伴 lujun9972

Related Issues not found

Please contact @lujun9972 to initialize the comment

Generated by Emacs 27.x(Org mode 9.x)

Copyright © 2014 - 2021 lujun9972   -   Powered by EGO
Themed with emacs_love


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK