Dear Experts,
I need to use expect.pm at work. I am wondering if there is a way to log onto a remote host once and execute multiple cmds?
According to the expect.pm's doc:
Also note that you cannot reuse an object with an already spawned command, even if that command has exited. Sorry, but you have to allocate a new object...
Right now, what I am doing is like this:
Create a new object, logon the remote host, execute ONE command, exit.
Create another new object, logon the remote host, execute the 2nd command, exit.
And so on, so forth, which is really tiresome.
There must be a more efficient way to do this kind task. Could some expert show me some sample codes?
Many thanks.
I need to use expect.pm at work. I am wondering if there is a way to log onto a remote host once and execute multiple cmds?
According to the expect.pm's doc:
Also note that you cannot reuse an object with an already spawned command, even if that command has exited. Sorry, but you have to allocate a new object...
Right now, what I am doing is like this:
Create a new object, logon the remote host, execute ONE command, exit.
Create another new object, logon the remote host, execute the 2nd command, exit.
And so on, so forth, which is really tiresome.
There must be a more efficient way to do this kind task. Could some expert show me some sample codes?
Many thanks.