Hi fooler,
Thanks for the reply.

I've tried what you have mentioned below but unfortunately, the device that
i'm connecting to doesn't support remote command execution using ssh.

Its an appliance device and there's only limited ssh configurations that I
can adjust.

I manage to find a solution to my problem using the script below, I just
thought I share it so that others can use it


#!/usr/local/bin/expect -f

spawn /usr/local/bin/ssh u...@remote-machine

expect {
   -re "->" {send "<command-here>\r"}'
}

expect {
   -re "--- more --- " {send " ";exp_continue}
   -re "-- more -- " {send " ";exp_continue}
   -re "-- More -- " {send " ";exp_continue}
   -re "->" {send "exit\r"}
}

expect {
   -re "->" {send "exit\r"}
}





> according to your expect script.. you are waiting for the command
> prompt, execute the command and then exit...
>
> why not use ssh to execute the command on the remote side?
>
> eg.
>
> $ ssh u...@host command
>
> it will do exactly the same with your expect script.. unless you need
> more interaction during the execution of that command thus you need
> the expect utility...
>
> fooler.
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>



-- 

Keyboard error, press F1 to continue
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to