我正在查看 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
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
#...some more code....
此行中第一个美元符号的原因是什么,因为看起来脚本没有它也能正常工作 - 不是吗?
echo -n $"Starting $prog: "
最佳答案
$"..."
是一个扩展,允许您 use gettext i18n in bash scripts .
关于linux - 为什么在此 bash 脚本中使用 $ 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7036148/