where should cmd scripts be stored code example
Example: make a command prompt with your own commands html
RED='\e[31m'
NOCOLOR='\033[0m'
GREEN='\e[92m'
echo -e "Getting PID's from port :$1..."
PIDINFO=`netstat -ano | findstr :$1`
if [ $# -eq 0 ]
then
echo -e "${RED}No port number specified"
echo -e "${NOCOLOR}Usage: kill-server [port-number]"
exit 1
fi
PIDINFOARR=($PIDINFO)
PID=$(echo "${PIDINFOARR[4]}" | sed '')
echo -e "Kill server :$1..."
if tskill "${PID}"; then
echo -e "${GREEN}Server port /:$1 with PID: ${PID} succesfully terminated."
else
echo -e "${RED}Server port /:$1 not succesfully terminated. It might be because server is not running."
exit 1
fi