please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine )
I want to verify if OS is linux
so if it true the expect check if prompt is "#" or ">"
and then run the "ls" command
but I get the error below
please advice what could be the problem
OS=solaris
expect_do_something=`cat << EOF
set timeout -1
spawn telnet 0 $IP_AD
I'm trying to run some expect language, and grep/parse the output all in one script.
Hello All,
I am writing an Expect Script to execute some commands over ssh then exit the script.
The script works just fine if I automate everything and assuming the correct password was entered.
So this Expect Script gets executed from a Bash script...
I created a script wherein it will change password of a user
Quote:
#!/usr/bin/expect
spawn passwd [lindex $argv 0]
set password [lindex $argv 1]
expect "New UNIX password:"
send "$password\r"
expect "Retype new UNIX password:"
send "$password\r"
Hi.
Here is beginning of my script
Code:
#!/usr/local/bin/expect --
set timeout 15
spawn /usr/local/account.sh -n modify
expect "Password:" {send "mypassword\r"}
But due to some terminal control sequences (or something else, dunno exactly) my password prompt is looking like this:
Code:
[[61;157R-n Password:
and expect doesn't recognize it.
I am trying to build and expect script to log into multiple aix boxes and change password.
I am building a simple ssh login wrapper tool to help auto login to one of hell
lots of servers.
It first takes descriptions from user input and then extract the corresponding (most relavant) server ip and password stored safely somewhere, using which it synthesis a piece of expect script.
Shell Scipt: temp.sh
<code>
su - <$username>
expect pass.exp
<code>
Expect script: pass.exp
#!/usr/bin/expect -f
# Login
#######################
expect "Password: " send "<$password>\r"
it comes up with Password: but doesnt take password passed throguh file.
The target of the following simple expect script is to get the hostname name on the remote machine
Sometimes expect script fail to perform ssh to $IP_ADDRESS ( because remote machine not active , etc )
so in this case the expect script will break after 10 second (timeout 10) , this is OK but......
There are two options
Expect script perform ssh successfully , and performed the command hostnam