Linux 为什么在这个bash脚本中使用$符号
我在看Fedora sysV init脚本示例,它是这样的:Linux 为什么在这个bash脚本中使用$符号,linux,bash,shell,Linux,Bash,Shell,我在看Fedora sysV init脚本示例,它是这样的: #...some code start() { [ -x $exec ] || exit 5 [ -f $config ] || exit 6 echo -n $"Starting $prog: " # if not running, start it up here, usually something like "daemon $exec" retval=$? echo [
#...some code
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
#...some more code....
这行中第一个美元符号的原因是什么,因为似乎没有它脚本会工作得很好-不是吗
echo -n $"Starting $prog: "
$“…”
是一个扩展,允许您使用。您可以链接到文档或至少是这方面的源代码吗?@jtbandes:我正在寻找一些,但很难找到。嗯。这里有一个例子,但他们使用括号:@Andre:那是因为这是一个完全不同的机制。;这是第10个项目符号,它链接到。