There is this solution to execute a shell script from a file. All good.
How to use SSH to run a local shell script on a remote machine?
On Windows in cmd
these 2 commands do the same and they both work
cat .\my_script.sh | ssh user@ssh.server.com "bash -s"
ssh user@ssh.server.com "bash -s" < .\my_script.sh
How can I run the same in powershell
in a similar way(using pipes) and not using any Get-Ouput
and weird powershell
commands?
If I run this script over powershell I get an error
cat .\my_script.sh | ssh user@ssh.server.com "bash -s"
bash: line 3: $'\r': command not found
' does not existuru
bash: line 6: $'\r': command not found
bash: line 12: $'\r': command not found