Skip to content

Instantly share code, notes, and snippets.

@Palpatineli
Created January 18, 2022 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Palpatineli/f0ad127b70fc45f69ef1b1186736e9b6 to your computer and use it in GitHub Desktop.
Save Palpatineli/f0ad127b70fc45f69ef1b1186736e9b6 to your computer and use it in GitHub Desktop.
get host ip and start server
#!/bin/sh
HOST_NAME=`hostname`
HOST_IP=`nslookup $HOST_NAME | awk /Address:\ [-.0-9]/ | awk -F\ '{print $NF}'`
if [ $# -eq 0 ]
then
PORT=54321
else
PORT=$1
fi
static-web-server -a $HOST_IP --port $PORT --root . &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment