How to "inject" lines into a redirect here doc?
I have a BASH function execute
that establishes a SSH connection to a machine and runs a bunch of commands provided here by redirecting the doc. This works great. Is there a way to insert some commands into the redirect? I would like to always run prepare_something
before eg do_something
.
function execute() {
ssh user@host /bin/bash
}
execute << EOF
do_something
EOF
+3
source to share