#!/usr/bin/expect
spawn -ignore HUP telnet <ip address>
expect "login:"
send "root \n"
send "cd /mnt\n"
send "mkdir -p /mnt/work\n"
send "mount server_path /mnt/work
send "cd /mnt/work/\n"
send "./run_script.sh &\n"
send "disown \n"
send "logout\n"
interact
run_script.sh
count=0
while [ $count -le 10 ];do
sleep 1
((count++))
echo $count
done
echo "**********************************************"
我的要求是注销应该在run_script结束之前发生,但是没有任何想法吗?