I am trying to collect an powershell script output in a shell script.
ssh user@host "powershell Test-Path -Path C:/myfile"
will if execute in bash just print
True .
If I save it to variable like ps_result=$(ssh ... >&1)
ps_result now contains ps_result=$'False\r'
which looks weird and I don't know what to do with it in an if statement.
I have two Questions:
- Can I use powershell to print something more useful than whatever $'False\r' is?
- How to handle such an output in an if statement
if [ $ps_result = 'False\r' ];does not work?