+ -
当前位置:首页 → 问答吧 → echo 带$输出疑问

echo 带$输出疑问

时间:2010-06-28

来源:互联网

linux目录/etc/init.c/下的文件中很多有使用echo带$,请问作用是什么?
如:echo $"test" 这里效果跟echo "test"是一样的吧。

作者: hxl   发布时间: 2010-06-28

回复 hxl


    难道不是输出变量test的值么?

作者: chenduo911   发布时间: 2010-06-28

echo $"test"
这里不是输出变量test的值,而是输出字符串test .

作者: hxl   发布时间: 2010-06-28

变量test的值= test?

作者: mercuyr   发布时间: 2010-06-28

echo "$test" --这样才是输出变量test的值,
但是echo $"test"的作用是什么呢?

作者: hxl   发布时间: 2010-06-28

extquote
                      If  set,  $'string'  and  $"string"  quoting  is performed within ${parameter} expansions enclosed in double quotes.  This option is
                      enabled by default.

作者: jerry017cn   发布时间: 2010-06-28

回复 hxl


    bash man里面有说明。

作者: blackold   发布时间: 2010-06-28



QUOTE:
extquote
                      If  set,  $'string'  and  $"string"  quoting  is performed within ${ ...
jerry017cn 发表于 2010-06-28 15:09




请问这些说明怎么查看?环境是linux

作者: hxl   发布时间: 2010-06-28

man bash

作者: jerry017cn   发布时间: 2010-06-28

bash


QUOTE:
    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.  

作者: blackold   发布时间: 2010-06-28

作者: yazi0127   发布时间: 2010-06-28

热门下载

更多