Is it possible to pass a here document as a bash function argument, and in the function have the parameter preserved as a multi-lined variable?
Something along the following lines:
function printArgs {
echo arg1="$1"
echo -n arg2=
cat <<EOF
$2
EOF
}
printArgs 17 <<EOF
18
19
EOF
or maybe:
printArgs 17 $(cat <<EOF
18
19
EOF)
I have a here document that I want to feed to ssh as the commands to execute, and the ssh session is called from a bash function.