i have written simple expect script but it doesnt work the way that i want can someone suggest wat is the issue?
#!/usr/bin/expect
spawn ssh abc@abc
expect "password:"
send "xyz\r"
expect "$"
send "mkdir hello\r"
#sleep 10
#exit 0
output
---------------
it does not create directory hello
[root@pqr ~]# ./login
spawn ssh abc@abc
Warning: Permanently added 'abc' (RSA) to the list of known hosts.
abc@abc's password:
Last login: Tue Jan 4 10:18:06 2011 from mno
xhost: unable to open display ""
-bash-3.2$ [root@pqr ~]#
[root@pqr ~]#
you give expect "$"
and the system gives Last login: Tue Jan 4 10:18:06 2011 from mno xhost: unable to open display ""
so this is not the expected answer.
actually the log in happens which you can see
Last login: Tue Jan 4 10:18:06 2011 from mno
xhost: unable to open display ""
-bash-3.2$
but after the expect "$" send command does nt get executed
send "mkdir hello\r"
my last answer stays...
Last login: Tue Jan 4 10:18:06 2011 from mno
xhost: unable to open display ""
-bash-3.2$
!=
$
i get what you mean. but can you please suggest something that can help me in moving further? i mean go into the prompt and execute the command in linux machine?