是否可以将此文档作为bash函数参数传递,并且在函数中将参数保留为多行变量?
以下内容:
function printArgs {
echo arg1="$1"
echo -n arg2=
cat <<EOF
$2
EOF
}
printArgs 17 <<EOF
18
19
EOF
Run Code Online (Sandbox Code Playgroud)
或者可能:
printArgs 17 $(cat <<EOF
18
19
EOF)
Run Code Online (Sandbox Code Playgroud)
我有一个here文档,我想将ssh作为执行命令提供给ssh会话,并从bash函数调用ssh会话.