Working Expect script failing when placed inside bash Loop.
Hi all,
I have a bash/expect script for connecting to multiple layered devices and working on them. I've tested this script and it works fully IE. test.sh deviceName. However I want this script to run on a list of devices, therefore i wrote another bash script which iterates it as such: while read line do DEVICE=$line test.sh $DEVICE done <deviceList.txt When I run it in a loop like this, the expect script simple ends after the first expect command, with no error message or explanation. Can anyone explain to me why putting this script in a loop is making it faulty? |
The test.sh script is most likely expecting something from stdin sort of like when you place ssh in a loop. e.g.
Code:
ssh server1 "ls" Code:
echo "server1 Code:
echo "server1 Unless you give more details about your script (such as the source) it is unlikely anybody can help you debug it. Also, you have a bit of redundant variable setting there. Why not just use while read DEVICE if you want to set the $DEVICE variable? There are more improvements that can be made but I'll leave you with that. |
All times are GMT -5. The time now is 02:04 AM. |