【发布时间】:2011-06-07 13:06:16
【问题描述】:
是否可以将here文档作为bash函数参数传递,并在函数中将参数保留为多行变量?
大致如下:
function printArgs {
echo arg1="$1"
echo -n arg2=
cat <<EOF
$2
EOF
}
printArgs 17 <<EOF
18
19
EOF
或者也许:
printArgs 17 $(cat <<EOF
18
19
EOF)
我有一个此处的文档,我想将它作为要执行的命令提供给 ssh,并且从 bash 函数调用 ssh 会话。
【问题讨论】:
标签: bash function shell arguments heredoc