Last active
August 29, 2015 14:09
-
-
Save bluerogue/65ac625d7a639777badf to your computer and use it in GitHub Desktop.
Single Line HTTP Server and Webpage
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
# This is a single line command to executed directly in the CLI. This will NOT run as a shell script | |
# as-is. This assumes you have Python installed and should work on any Mac OS X system and most | |
# linux systems. | |
# | |
# This changes to the user's home directory, creates and changes into a public_html directory, | |
# creates a file called index.html with the contents "Hello, {username}", starts a Python HTTP server, | |
# and finally attempts to open your default browser to the webpage. If this last step doesn't happen, | |
# simply open a browser and go to http://127.0.0.1:8080. | |
cd && mkdir public_html && cd public_html && echo 'Hello,' $USER >> index.html && python -m SimpleHTTPServer 8080 & open http://127.0.0.1:8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment