Created
January 18, 2022 17:27
-
-
Save Palpatineli/f0ad127b70fc45f69ef1b1186736e9b6 to your computer and use it in GitHub Desktop.
get host ip and start server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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