Bash中双引号前的美元字符 [英] Dollar character before double quotes in Bash
本文介绍了Bash中双引号前的美元字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近读了一些bash代码echo $"asdf"
,$
的作用是什么?
I recently read some bash code, echo $"asdf"
, what is $
for?
$"asdf"
和"asdf"
有什么区别?
推荐答案
如 bash手册,它用于本地化:
用双引号引起来的字符串前面带有一个美元符号('$'), 根据当前语言环境转换的字符串.如果 当前语言环境为C或POSIX,美元符号将被忽略.如果 字符串被翻译和替换,替换用双引号引起来.
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.
这篇关于Bash中双引号前的美元字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文