create a terminal in javascript code example
Example: make a command prompt with your own commands html
#kill-server
#!/bin/bash
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
# Convert to array
PIDINFOARR=($PIDINFO)
# Get the PID
PID=$(echo "${PIDINFOARR[4]}" | sed '')
# Kill the server
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