title: Implementing netcat in bash
body: <p>As the basis for a larger script I'm trying to write I'm trying to basically implement a basic netcat client in bash. My current script techincally works, it looks like this:</p>
  
  <pre><code>#!/bin/bash
  
  exec 3&lt;&gt;/dev/tcp/$1/$2         
  
  cat &lt;&amp;3 &amp;                      
  cat &lt;&amp;1 &gt;3
  </code></pre>
  
  <p>The problem with it is that it leaves a hanging cat process which needs to be killed, but I can't figure an automatic way to do so, and manually running <code>pkill cat</code> doesn't really seem sporting.</p>