linux - 询问bash脚本的含义

标签 linux bash shell

我有一个shell脚本application.sh,如下。

#! /bin/busybox sh

set -o nounset -o errexit

readonly emul_script="/usr/local/bin/emul.sh" 
readonly profile="/etc/vendor/profile"    
source "${profile}"                

_usage() {
        cat << EOF
${0} [-d]
        -d      :debug
EOF

上面的脚本启动了一个特定的应用程序。我的问题与_usage开始的部分有关,我不太明白它的意思,也看不出它是如何使用的。

最佳答案

<<heredoc构造和 cat将结束标记(在本例中为 EOF)之前的所有内容都发送到标准输出。

${0}是输入文件的名称,这将向标准输出打印如下内容:

application.sh [-d]
    -d      :debug

您缺少结尾的 }顺便说一下。

关于linux - 询问bash脚本的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7768487/

相关文章:

linux - 使用适用于 Linux 64 位的 GNAT 2019 公共(public)版本在 Linux 上配置 PolyORB 失败

linux - 更新时如何使分支更改反射(reflect)在主服务器上?

javascript - 将 Cyber​​power UPS 的 JSON 解析为 InfluxDB/Grafana

php create_directory 权限被拒绝 : when attempting shell_exec script

bash - 用法 : command not found

linux - dlang是否默认安装一些信号处理程序

linux - 如何从 Windows 服务器联系 linux ClearCase 客户端

regex - Grep:无效的重复计数

ios - 如何使用 PlistBuddy 将数组添加到 Plist?

shell - 批处理文件在 mvn 命令后停止执行