On Cygwin, I want a Bash script to: Create an SSH tunnel to a remote server. Do some work locally that uses the tunnel. Then shut down the tunnel. The shutdown part has me perplexed. Currently, I have a lame solution. In one shell I run the following to create a tunnel: # Create the tunnel - this works! It runs forever, until the shell is quit. ssh -nNT -L 50000:localhost:3306 jm@sampledomain.com