-1
a.sh的其實我寫2個腳本
#!/bin/sh
PASSPHRASE="PASS"
for i in 1 2
do
echo "say hii:"
done
首次 b.sh
#!/usr/bin/expect -f
spawn ./a.sh
sleep 2
for {set x 1} {$x<3} {incr x} {
expect "say hii:"
send "hii\r"
sleep 10
interact
}
executing ./b.sh
所以另一個腳本它正在發送say hii: "and we are sending hii"
for the second time it getting struck in say hii:
所以我想發兩次意味着有多少次循環。寫作後