Skip to content

Instantly share code, notes, and snippets.

@Palpatineli
Created January 18, 2022 17:27
Embed
What would you like to do?
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