$ {HTTPD -...} Perl语法

geo*_*lee 0 bash shell

好吧,我无法通过阅读Perl的文档来解决这个问题.我在看Apache的RHEL4 init脚本......这行代码有什么作用?

httpd=${HTTPD-/usr/sbin/httpd}
Run Code Online (Sandbox Code Playgroud)

为什么不httpd=/usr/sbin/httpd呢?所有额外的语法有什么用?

-Geoffrey Lee

Sch*_*ern 6

这不是Perl,它的外壳.Init脚本通常用shell编写.具体来说,它意味着"如果已定义,则使用HTTPD环境变量,否则使用/ usr/sbin/httpd".

看看这里获取更多信息.