Webserver in bash (2007)
paulbuchheit.blogspot.ca
paulbuchheit.blogspot.ca
EDIT: I think this is it: http://ur1.ca/f2ozi
Netcat (nc) is built in to nearly every system that has bash. Wget and Curl on the other hand, are not.
echo, true, false and [ are builtins in bash and are in the binary. You can even do TCP/UDP through bash by using the pretend redirect files /dev/(tcp|udp)/$host/$port.
curl or wget exists on most systems by default in a minimal installation now days, nc does not, but if you run a normal installation you will get it though.
josephredfern@ubuntu:~$ which [
/usr/bin/[ $ type [
[ is a shell builtin$ echo $SHELL
/bin/bash
$ type echo true false [
echo is a shell builtin
true is a shell builtin
false is a shell builtin
[ is a shell builtin
You could do the same in zsh, or another compatible shell, using netcat, so while semantics may be on your side, the server does run in a BASH shell.
I was under the impression that wget, curl, etc, are external binaries and not built in to the BASH shell.
listen -A 'tcp!*!9000' { {req := "{sed '/^\r$/q'}; echo 'HTTP status and headers elided'; echo $req} & }
Throw a way to do some real routing in there and you might be on to something. It's an interesting idea, with the trends of blogs (like mine even) going to octopress, simplifying the serving of static text is greatly beneficial.