call & execute the shell script within expect script
Posted
by
D.C.
on Stack Overflow
See other posts from Stack Overflow
or by D.C.
Published on 2012-04-09T04:41:59Z
Indexed on
2012/04/09
5:29 UTC
Read the original article
Hit count: 271
expect
#!/usr/bin/expect
spawn ssh derrick@$abc123.net
expect "password"
send "helloworld\n"
send "cd /tmp\n"
send "sh rename.sh\n" # this shell script will get a list of files and rename each file
send "exit\n"
expect eof
The problem is when 'rename.sh'
started and within less than 3 seconds, the 'expect'
script exits while 'rename.sh'
is not yet done executed.
My question is how can I make my expect script to wait for the finish of 'rename.sh' execution?
© Stack Overflow or respective owner