How to execute a program at expect script

what i need is that after passwordless enter another program should execute. I can succeed passwordless login but could not execute (./son) program. pls help me

Did you read any of the many guides and howtos? I bet there is somewhere an example how to execute a program after login. Post what you got so far, ty.

Try using ssh

ssh -l $UserName $RemoteHost command

I want at expect script to execute another program for example:

#!/usr/local/bin/expect

spawn ssh root@172.30.64.163

expect "login:"
send "root\n"
expect "password:"
send "root\n"

send "./son" ----it does not work instead of this what should i write

interact

Use CODE-tags when posting code, data or logs for better readability and to keep formatting/indention etc, ty.

Is "son" available on the destination machine?
What is the error you get?..

"son" is available on the dest. machine. I dont get an error because the duty of send is writing what you write inside the " ". So it is printing ./son on the screen but it dont execute it.

I am not using expect but having a short look into some tutorial I saw they often use \r when sending commands which looks like a enter stroke or something, like

send "./son\r"

If still nothing gets executed maybe try to add an "exec" inside the quotes in front of "son\r".

Check this
DeBaan: Simple expect ssh example
or any other of the 32.800.000 hits you get when you google for "expect tutorial".