Hi All!
I need to automate the su command using expect script.Suppose I login as a user A , I need to change the user to oracle using the su oracle command and execute the command "sqlplus -ver".
I tried writing a expect script for the same , but can't figure out the reason it is not working.
Can someone please help. Below is the expect script that I wrote:
#!/usr/bin/expect -f
set timeout -1
spawn /bin/su oracle -c date
expect "Password: "
send "oracle\r"
expect "\r\n"
send "sqlplus -ver\n"
Thanks!
nua7