not exit out of the loop.. basic mechanic of the program should be,
for N in a b c d e f g h i j k
do
for X in 1 2 3 4 5 6 7 8
do
output=$(someprogram $X@$N)
if [ $output -eq whatever ] ; then
echo "$X@$N is $output"
else
echo "$X@$N is NOT whatever"
fi
done
done
Problem is, this someprogram that I am running so that it will either spit out
1)whatever OR 2)some other response but in order to quit from that program, you need to do control c
a)where do I put control c statement in the script
b)and more importantly, HOW do I send control c from shell script..
above program will spit out either of below outputs
Connected to someprocess@host3
>type message
> <--- since we are just seeing whether we can connect to this process, we will quit this bye
doing control C
OR
Cannot connect: connection refused
OR maybe I am just doing a wrong thing with shell script.. maybe I need to run Expect??
Connected to someprocess@host3
>type message
> <--- since we are just seeing whether we can connect to this process, we will quit this bye
doing control C
OR
Cannot connect: connection refused
If I was doing this interactively,
I would type
./program process.1@host13
IF process.1 was doing what's it suppose to be doing, i would see
Connected to someprocess@host3
>type message
>
and I can type command and do stuff... and only way to quit out of that is to do control-C
But if you do get above message it means from my host to that process on host3, I am able to communicate and that's what I am trying to find out
If process.1 was not up, than I would see
Cannot connect: connection refused
and it will give me back the prompts.
Please let me know if needs more info..
I am just not sure if sending control c within loop is possible in the script or not