小编Nie*_*ng 的帖子

这里将文档作为bash函数的参数

是否可以将此文档作为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会话.

bash shell arguments function heredoc

26
推荐指数
3
解决办法
1万
查看次数

标签 统计

arguments ×1

bash ×1

function ×1

heredoc ×1

shell ×1