Ive got a very basic powershell script which uses Start-Process
to start another .sh script, this is working and the scripts do execute but what I need is to be able to capture the output of the called script.
Content of the scripts is below:
main.ps1
Start-Process 'C:\Program Files\Git\git-bash.exe' -ArgumentList '-- C:\test\sub.sh' -Wait -RedirectStandardOutput output.txt
sub.sh
#!/bin/bash
echo "Hello World"
The sub.sh launches and prints out Hello World
in its own console, but I really need the output to either go to the calling powershell scripts console window, or to a file. The file I specify in the -RedirectStandardOutput
parameter is created, but is empty.
How can I get the sh script to print to standard out to the calling script?
Thank you