Bash scripting... ssh?
Hi all,
I'm very new to bash scripting and I am a bit confused about a few things. My question is: is there a way to pass commands to an interactive program? An example could be ssh, how do I make a script that commits an ssh connection, gives the password and input some commands to a remote box? I know this is a quite newbie question but, hey, I'm doing my best! Thank you all! |
As an example:
Let's say a file called myscript contains a series of commands: open myhost cd /somewhere ASC get somefile bye You can then pass these commands to ftp (or any other program. I created a simple ftp script as an example): Code:
ftp < myscript |
|
As for the ssh example, you can use RSA authentication so you don;t need to enter a password, and then start ssh (from a script) more or less like this:
Code:
ssh -l username 10.0.0.122 " script command #1 Code:
cat somescipt | ssh -l username 10.0.0.122 - |
well, for authentication I'll try another way.
Thank you all |
All times are GMT -5. The time now is 03:28 PM. |