Bash (shell-script) is a very powerful language, but a bit too complicated for the non-programmer (computer hacker). Then we got Perl, but it is also a bit too complicated. Now we have JavaScript doing the same thing, but also JavaScript (ES6) is now getting more complicated. I wonder is there a rule that says a (scripting) language for non-programmers will eventually either die or end up being too complicated for no…
Shinatra – A simple bash web server
21–30 of 37 posts
Re: Shinatra – A simple bash web server
#22 exec 3/dev/tcp/localhost/8080
echo -e "GET / HTTP/1.1\n\n" >&3
cat Re: Shinatra – A simple bash web server
#23Earlier quoted context omitted.
Considering C has the semicolon, you can probably write it in less than 5 because you can put almost anything on a single line.
Bash also has a semicolon. This script could be done in two lines. Or even one if you omit the shebang.
Re: Shinatra – A simple bash web server
#24Not that big.
Re: Shinatra – A simple bash web server
#25Re: Shinatra – A simple bash web server
#26 $(command -v python2 || command -v python2.7 || command -v python2.6) -c
"import BaseHTTPServer, SimpleHTTPServer;
s = BaseHTTPServer.HTTPServer(('', {port}), SimpleHTTPServer.SimpleHTTPRequestHandler);
s.serve_forever()"Re: Shinatra – A simple bash web server
#27Bash (shell-script) is a very powerful language, but a bit too complicated for the non-programmer (computer hacker). Then we got Perl, but it is also a bit too complicated. Now we have JavaScript doing the same thing, but also JavaScript (ES6) is now getting more complicated. I wonder is there a rule that says a (scripting) language for non-programmers will eventually either die or end up being too complicated for no…
Never heard "Build a system that even a fool can use and only a fool will want to use it." ?
Re: Shinatra – A simple bash web server
#28This reminds me a lot of Certbot's use of the Python SimpleHTTPServer: $(command -v python2 || command -v python2.7 || command -v python2.6) -c "import BaseHTTPServer, SimpleHTTPServer; s = BaseHTTPServer.HTTPServer(('', {port}), SimpleHTTPServer.SimpleHTTPRequestHandler); s.serve_forever()"
Re: Shinatra – A simple bash web server
#29> Is this a thread based server, or does it use an event loop instead? > No. Well, which is it ?
Neither, its using netcat + -l flag, which is (possibly) waiting for a connection using blocking networking IO. It can only accept one connection at a time because of the netcat command being used in a loop
Well, anyone can write that in a handful of lines in most languages.
Re: Shinatra – A simple bash web server
#30Many people here fail to realize, this is an excellent debugging server. I used to have a server to print out the body and headers of requests when building an api to make sure things were going (the right headers and request body) out as expected https://github.com/minhajuddin/httpdebug/blob/master/app.go . This is a much lighter and nicer version. This is going into my ~/bin/httpdebug :) You can try sending a few c…