From: Ken I. <fn...@ua...> - 2007-05-08 17:24:26
|
On Tue, May 08, 2007 at 05:16:40PM +0530, Sujai Kumar wrote: > Hello everybody., > > I am new to expect. I want to execute some commands after SSH'ing > into a machine say 10.2.3.4. I have written script to automate ssh and > that is happening fine. After SSH'ed into the machine it exits from > the machine. How to execute a command in the SSH'ed machine. If all you want to do is issue commands, ssh is capable of doing that directly, e.g., (from a shell prompt): $ ssh 10.2.3.4 tail /var/log/syslog This can be automated by setting up key-based authentication and ssh-agent, e.g., using the keychain utility. IMHO Expect.pm and such are called for when you want to automate interactivity with the remote system, i.e., generate output commands based on the responses seen. Ken -- Ken Irving, fn...@ua..., 907-474-6152 Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks |