是否可以在 bash 函数中插入一个heredoc?
下面的简单示例会导致错误: ./heredoc_in_function.sh: 10: Syntax error: end of file unexpected (expecting "}")
#!/bin/sh
my_function () {
cat <<HEREDOC
heredoc contents
HEREDOC
}
my_function
Run Code Online (Sandbox Code Playgroud)
环境: