title: How can I match a pattern over TCP?
body: <p>I'm trying to write a monitoring script. It should connect to some port on my server, read the output, and if the output is the expected value, print 1 otherwise 0.</p>
  
  <p>I'm working on a solution involving <code>cat &lt; /dev/tcp/hostname/port</code>, but the solution eludes me. Maybe something involving expect? I'd prefer a bash script solution. Help appreciated!</p>