Run command - Terminal

Asked

Viewed 56 times

-1

Remembering that this is not just for this case, I want to create for example . Bats to automate some things, so I would like to know how to make you wait for the return of commands and interpret my next line as response.

How can I make the file . bat answer a question comes from a command, for example:

I spin:

ssh -p port user@host

And then it asks for the password, as in the next line I do to answer it programmatically in the same . bat?

I tried to:

ssh -p port user@host
PASSWORD

But it doesn’t work, it discards my password and requires it on the next line.

1 answer

2

I believe that

echo PASSWORD | ssh -p port user @ host

serves what you want

  • I don’t know if my specific case doesn’t work, but when I run it, it makes a mistake: Pseudo-terminal will not be allocated because stdin is not a terminal. and then it goes like I’ve just run the ssh -p port user @ host

  • I don’t know if it will work but try it -> echo PASSWORD | ssh -tt -p port user @host

Browser other questions tagged

You are not signed in. Login or sign up in order to post.