Upgraded to 24.04 on two servers, and cannot run remote script (heredoc) on second server from first server as I did on 22.04 before. Is this option removed from Ubuntu 24.04?
Upgraded to 24.04 on two servers, and cannot run remote script (heredoc) on second server from first server as I did on 22.04 before. Is this option removed from Ubuntu 24.04?
I'm assuming your indentation is some version of this
It's not right to say "the heredoc is executed on 192.168.1.2", the heredoc is processed on your local machine including the command and variable substitutions. The resulting text is passed as an argument to ssh to be executed on the remote host.
If you want that to be literal text, then quote the heredoc marker:
Note you are using a form of the anti-pattern
ssh already exits with a success/failure status, and a function exits the status of the last command executed:
Other notes:
We don't even really need a heredoc, plain quoting works as well
logname
is never executed, one of theexit
s happens first (it could be I didn't understand your indentation)capturing the version file is awkward, relying on cat failing. How about