0

I have a script on my local machine, script.sh. I want to run it on a remote server that is only accessible by multiple ssh.

script.sh:

ls ls ls 

I tried:

user@localhost:~/$ ssh -At host1 ssh -At host2 "bash -s" -- < ./script.sh 

but the output was split onto multiple lines:

user@host2:~/$ ls examples.desktop user@host2:~/$ ls examples.desktop user@host2:~/$ ls 

I also would like this to execute without putting me in a terminal on the remote machine.

How can I get the script to execute as a single command?

    1 Answer 1

    0

    I was able to fix this by removing the -t flag, so that ssh didn't put me in a terminal on the remote host.

    user@localhost:~/$ ssh -A host1 ssh -A host2 "bash -s" -- < ./script.sh 

    Output:

    examples.desktop examples.desktop examples.desktop user@localhost:~/$ 

    It also kept me on the local host rather than landing me in a terminal on the remote host.

      You must log in to answer this question.

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.