0

I want to make a program with bash script, that can check if there is a string data from specific port in my machine. Can you help me with this programming? thanks... *sorry for my bad english

example: *my machine port 7090, and if there is a string data receive in that port then execute a line of bash program else execute another program

if(there is a string data in port)
{
  read data from that port
}
else
{
  print data to another port
}

How to make bash script to check "there is a string data in port"?

user2745521
  • 1
  • 1
  • 2
  • 2

1 Answers1

0

Why I Think its related to question asked in the Link

Click above link to check the related forum on stackoverflow

Community
  • 1
  • 1
Ashish
  • 1,856
  • 18
  • 30
  • i think, that work if i know format data in that port. How when i didn't know the data format? – user2745521 Oct 30 '13 at 06:08
  • That you can verify first via catwalks answer there `echo "GET /"|netcat google.com 80` – Ashish Oct 30 '13 at 06:18
  • how to make it a conditional if(), if there is string data that receive in my machine port? – user2745521 Oct 30 '13 at 06:26
  • I am not sure but can use character count wc or grep -c and check with pipe in between – Ashish Oct 30 '13 at 06:51
  • Other members can give you exact answers Even I looking forward how it will work for your solution also don't forget to post correct answer which worked for you – Ashish Oct 30 '13 at 06:53