How to execute bash-script on a remote host and get the output locally
![](https://i0.wp.com/www.web-workers.ch/wp-content/uploads/2016/09/ssh-everywhere1.png?resize=500%2C300&ssl=1)
- Make sure you have enabled passwordless SSH logins to the remote host.
- Use bash to load environment variables that are required by the remote-script
ssh root@$10.37.25.145 bash -c "/local/app/myscript.sh"
- Or use the command in a bash-script
RESULT=`ssh root@10.37.25.145 bash -c "/local/app/myscript.sh"`
echo ${RESULT}