如何在期望范围内在后台运行脚本

时间:2018-09-03 14:33:48

标签: bash expect

 #!/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结束之前发生,但是没有任何想法吗?

0 个答案:

没有答案