Skip to content

Instantly share code, notes, and snippets.

@ptdorf
Forked from justecorruptio/server.sh
Created April 15, 2017 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptdorf/9b9ee358e2746319f7f1bb46c41e9f7d to your computer and use it in GitHub Desktop.
Save ptdorf/9b9ee358e2746319f7f1bb46c41e9f7d to your computer and use it in GitHub Desktop.
Bash www server. Golfed from github.com/jaburns/ngincat
#!/bin/bash
:|((read f g h
[[ -f .$g&&$g != *..* ]]&&echo "$h 200 OK
"&&cat .$g)|nc -lp$1)>/dev/fd/0;$0 $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment