【发布时间】:2012-05-24 10:21:57
【问题描述】:
在 Bash 脚本中,是否有一个单独的语句替代方案?
if [ -f /path/to/some/file ]; then
source /path/to/some/file
fi
最重要的是文件名只存在一次,而不是使其成为变量(这会增加更多行)。
例如,在 PHP 中你可以这样做
@include("/path/to/some/file"); // @ makes it ignore errors
【问题讨论】:
标签: bash error-handling include