>>902
Tomcatが8080で待ちうけている場合
/usr/sbin/lsof -t -i TCP:8080 -P

シェルスクリプトじゃないけどね。