If you skip -f and use & to put it into the background I think you can capture the pid in $!

ssh -NT -L 6111:remote.server.org:8080 -L 6112:remote.server.org:8080 me@tunnel.server.org & PIDOF=$!

Jonathan

On Wed, Jan 6, 2016 at 2:38 PM, Snyder, Alexander <alex@misteralexander.com> wrote:
Hello!

I have written a script that establishes an SSH Tunnel and does Port Forwarding from a local CYGWIN Shell ....

When I try to kill the tunnel by the PID, I get nothing ...

Does anyone know how CYGWIN handles PIDs in a local Shell?

PIDOF=$!
echo -e "Local Port 6111 is now resolving content from \"remote.server.org:8080\""
echo -e "Local Port 6112 is now resolving content from \"remote.server.org:8080\""
echo -e ""
echo -e "Port Forwarding ${red_back}${yellow_text}Active${norm_text}${norm_back}:"
            while true
                do
                    echo -e "Press Any Key to ${red_text}STOP${norm_text} Port Forwarding ..."
                    read kill
                    case $kill in
                        *) kill $PIDOF ;;
                    esac
                done
    ;;
esac

I'm just getting an empty variable (kill has nothing to kill) .... since this is just a local shell and not a full fledged system, I was wondering if anyone knew how CYGWIN handles PIDs.

--
Thanks,
--:: Alexander J. Snyder ::--
--:: ThisGuyShouldWorkFor.Us ::--
--:: "Never trust a computer you can't throw out a window. --Steve Wozniak" ::--
--

---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss