Actually i am writing 2 scripts of
a.sh
#!/bin/sh
PASSPHRASE="PASS"
for i in 1 2
do
echo "say hii:"
done
another script of 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
so for the first time it is sending say hii: "and we are sending hii"
for the second time it getting struck in say hii:
so i would like to send two times means how many time for loop is there.
a.sh
finishes after writing say hii twice
#!/bin/sh
PASSPHRASE="PASS"
for i in 1 2
do
echo "say hii:"
IFS= read -r line && echo "$0 read: $line"
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 1
}
interact
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments