我读rh9的rc.sysinit脚本,发现了这个很奇怪的表达式。$"$string",$"This is a string..."
直接在bash中运行这些表达式和没有第一个$是一样的。不解。为什么它要这样做呢?用意何在呢?
我粗粗的翻了一下ABS没有提到$的这个结构。
----
不小的能不能上传成功。。。
[问题]看过ABS,它也没有涉及到这个表达。$"$string"
- cnkilior
- 论坛版主
- 帖子: 4984
- 注册时间: 2007-08-05 17:40
[问题]看过ABS,它也没有涉及到这个表达。$"$string"
- 附件
-
- cc.tar.gz
- (9.85 KiB) 已下载 42 次
- alinmn
- 帖子: 185
- 注册时间: 2006-05-19 21:42
- 来自: NIT
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
man bash
QUOTING
QUOTING
- cnkilior
- 论坛版主
- 帖子: 4984
- 注册时间: 2007-08-05 17:40
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
貌似楼上说的不太对。
- alinmn
- 帖子: 185
- 注册时间: 2006-05-19 21:42
- 来自: NIT
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
不是吧 里面还提到了$'xx'这种,现在在windows下 没法贴
- cnkilior
- 论坛版主
- 帖子: 4984
- 注册时间: 2007-08-05 17:40
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
里面是提到了$'xx'没有$"xx",单引号和双引号有区别的。
- alinmn
- 帖子: 185
- 注册时间: 2006-05-19 21:42
- 来自: NIT
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
汗一下先
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.
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.
- cnkilior
- 论坛版主
- 帖子: 4984
- 注册时间: 2007-08-05 17:40
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
哎,看的不仔细,呵呵。
---
原来在这段的最最后面。。。
---
细看了一遍,不知道理解是不是正确的。
$'string'会把里面的转义(\)当作转义来处理
$"string"会把双引号里的按照当前的local来处理,如果当前local是C或POSIX则忽略$。
---
那么这个手册里所指的local是什么意思,(我仅有一次看过有人写export LANG='C')它和LANG变量有联系吗?
如果没有联系那么其他的local有哪些呢?如何转换成他种local?(我也想看看$"string"的效果)
---
原来在这段的最最后面。。。
---
细看了一遍,不知道理解是不是正确的。
$'string'会把里面的转义(\)当作转义来处理
$"string"会把双引号里的按照当前的local来处理,如果当前local是C或POSIX则忽略$。
---
那么这个手册里所指的local是什么意思,(我仅有一次看过有人写export LANG='C')它和LANG变量有联系吗?
如果没有联系那么其他的local有哪些呢?如何转换成他种local?(我也想看看$"string"的效果)
- alinmn
- 帖子: 185
- 注册时间: 2006-05-19 21:42
- 来自: NIT
Re: [问题]看过ABS,它也没有涉及到这个表达。$"$string"
不懂哎 我只是找到了 没理解