Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为我自己的服务创建一个启动脚本,并查看一些现有的服务启动脚本以寻求帮助。在 /etc/init.d/atd 启动脚本中,我看到以下构造:
echo -n $"Stopping $prog: "
我找不到任何关于以 $ 开头的字符串的文档。它似乎与不使用 $ 符号完全相同。任何人都知道您为什么要这样做,甚至在记录了这种晦涩用途的地方会做得更好?到目前为止,谷歌并没有提供帮助。
该脚本是 /bin/sh (bourne shell) 方言。
这是 CentOS 6.2 版(最终版)
前面有美元符号的双引号字符串$"string"将导致字符串根据当前语言环境进行翻译。如果当前语言环境是 C 或 POSIX,则忽略美元符号。如果字符串被翻译和替换,则替换是双引号。
$"string"