Advertisement
uriel1998

BASH script to call when using Python's built-in HTTP server

Apr 20th, 2012
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # To be used to call Python's simple HTTP server.
  4.  
  5. localip=$(ifconfig | grep -e addr: | grep -e Bcast | awk '{print $2}'| awk -F ":" '{print $2}')
  6. echo "This script will start a webserver at"
  7. echo "$localip on port 8000 showing"
  8. echo "$PWD.  Do you want to continue [y/N]?"
  9. read CHOICE
  10. case "$CHOICE" in
  11.     [Yy]*)
  12.         notify-send --icon=notification-network-wireless-full "Serving $PWD on port 8000"
  13.         python -m SimpleHTTPServer
  14.         notify-send --icon=notification-network-wireless-disconnected "Stopped sharing $PWD"
  15.     ;;
  16.     *)
  17.     ;;
  18. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement