All pastes #163878 Raw Edit

akill

public shellscript v1 · immutable
·published 2006-09-08 00:30 UTC
rendered paste body
#!/usr/local/bin/bashfunction checkport {  echo -n "what port would you like to check?: "  read PORT  if [ "`sockstat -4 | awk '{print $6}' | tr ":" " " | awk '{print \" \" $2 \" \"}' | grep \" ${PORT} \"`" ]; then          echo "that port IS in use.";     else          echo "that port is NOT in use";  fi}while [ "1" ]; do  echo -n "would you like to check for an open port? [y/n]: "  read ANSWER  case ${ANSWER} in    y | Y)       checkport;;    n | N)       echo "quitting"       exit 0;;  esacdone