Skip to content

Instantly share code, notes, and snippets.

@aroscoe
Forked from iamjwc/serve.sh
Created May 16, 2011 22:08
Show Gist options
  • Save aroscoe/975488 to your computer and use it in GitHub Desktop.
Save aroscoe/975488 to your computer and use it in GitHub Desktop.
Start a simple python server to serve files
#!/usr/bin/env bash
IP=`ifconfig | grep "inet " | grep -v "inet 127.0.0.1" | cut -f 2 -d " "`
PORT=$1
if [ -z "$1" ]
then
PORT=8000
fi
# Copy ip and port to pasteboard
echo $IP:$PORT | pbcopy
echo Serving at $IP:$PORT
# Start http server on port passed in
python -m SimpleHTTPServer $PORT &> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment