I have a working bash script that needs to be executed over SSH. My idea is to wrap the whole script into a ssh call. However I run into troubles when I need to run this line:
ssh localhost '''
> set -x
> awk -F 'pattern' '{print $2}' <<< "pattern here"
> '''
+ awk -F pattern '{print' '}'
awk: cmd. line:1: {print
awk: cmd. line:1: ^ unexpected newline or end of string
'''
Looks like $2 is lost. I have tried to escape it with \ or $$ to no avail. It also looks like the single quotes are lost from pattern, but not from '{print' '}'
I know I could copy the script with SCP and invoke it later with SSH, but I would rather not do that.
Thanks on advance.