I want a script which kills the instance(s) of ssh
which are run with the -D argument (setting up a local proxy).
Manually, I do ps -A | grep -i ssh
, look for the instance(s) with -D, and kill -9 {id}
each one.
But what does that look like in bash script form?
(I am on Mac OS X but will install any necessary commands via port
)
pgrep
andpkill
are commands to reliably find or kill processes by name under Solaris and Linux. – Gilles 'SO- stop being evil' Jan 12 '11 at 08:12