I have a bash script and i need to communicate with a server with netcat. I want to do
1.Connect with nc
2.Read Answer
3.Decide what to do with answer
4.Send a data to server
5.Go back to 2
Here is my code. But It does not advance after echo $JOB_STRING | netcat $BAGLANTI $PORT
$(echo $JOB_STRING | netcat $BAGLANTI $PORT)
read line
if [[ $line == "2.7" ]]; then
echo Sunucu Verisyonu $line
---Send something to nc server
else
echo "İş geldi"
---Send something to nc server
fi
I've also tried to store response in a variable but that didn't work too
RESPONSE="$(echo $JOB_STRING | nc $BAGLANTI $PORT)"
if [[ $RESPONSE "2.7" ]]; then
echo Sunucu Verisyonu $line
else
echo "İş geldi"
fi