Skip to main content
1 of 4
janos
  • 11.7k
  • 3
  • 37
  • 54

To pass input from a local file to ssh, you should use input redirection like this:

ssh user@server < abc.txt

Are you sure the _ must be really a single character? In that case this is possible if x is configured in ~/.ssh/config as an alias to some user@host:

ssh x < abc.txt

I cannot answer Q2 because I don't really understand it. I suppose Remote.txt is on the remote.

As per the second question, I suppose Remote.txt is a file on the remote side, in which case the command should be of the form:

ssh user@server "bash < Remote.txt"

..but this does not fit the problem description with _ _ _ and of course to remove the trailing tabs some more would be necessary like:

ssh user@server "bash < <(sed -e 's/^[    ]*//' Remote.txt)"

I hope this helps anyway.

janos
  • 11.7k
  • 3
  • 37
  • 54