Expect problem: sh: /usr/local/bin/stty: not found
794093Oct 2 2010 — edited Oct 7 2010I am new to Solaris, running the following:
ubik1:~/src/expect> uname -a 2
SunOS devfusion01 5.10 Generic_137137-09 sun4v sparc SUNW,T5140
I have used Expect on other Unixes before, but am having trouble in my current
Solaris environment.
I have searched and found this problem many times on the Internet, but without
finding any definitive solution!
When I try and run even the simplest Expect script, I get the error:
sh: /usr/local/bin/stty: not found
Now my stty is in /bin/stty, and Expect is in /usr/local/bin/expect.
I have tried putting /bin as the first item in my path, and I have tried setting the
PATH environment inside my Expect script, to no avail.
I have seen several suggestions to make a symbolic link to /bin/stty in /usr/local/bin,
but I have not seen anyone say that this actually worked.
This seems like one of those issues that should not be this hard to find an answer to.
I do not have access to be able to create the link, but if you guys tell me that should fix
the problem, I will ask my sysadmin on Monday.
Here is my script... it seems to always die on the "send" command, along with the error
mentioned in the subject line:
#!/usr/local/bin/expect --
log_user 1
# uncomment the following for debugging
#exp_internal 1
#set env(PATH) "/bin::$env(PATH)"
#puts "path = $env(PATH)"
spawn /usr/sfw/bin/zsh
set argc [llength $argv]
set timeout -1
expect {
"*>"
send "whoami\r"
expect {
"jweisenheimer" { send_user "got it" }
}
interact
}
Here is the output:
ubik1:~/src/expect> ./test.exp 127
spawn /usr/sfw/bin/zsh
sh: /usr/local/bin/stty: not found
ubik1:~/src/expect> usage: send [args] string
while executing
"send"
invoked from within
} expect {obrace > send {whoami
"jweisenheimer" { send_user "got it" }
} interact"
invoked from within
"expect {
">"
send "whoami\r"
expect {
"jweisenheimer" { send_user "got it" }
}
interact
}"
(file "./test.exp" line 21)
Thanks in advance,
Mitch