Dear visitor, in case we do not cover a topic you are looking for, then feel free to ask in our freshly created forum for IT-professionals for a solution. We hope our visitors can help you out with your questions. Have a good one. ~ Tom.

How to execute bash-script on a remote host and get the output locally

  1. Make sure you have enabled passwordless SSH logins to the remote host.
  2. 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"
  3. Or use the command in a bash-script
    RESULT=`ssh root@10.37.25.145 bash -c "/local/app/myscript.sh"`
    echo ${RESULT}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.