Learn the UNIX/Linux command line

Improve this Script and Win $100USD

After publishing 10 Linux commands you’ve never used I was the benefactor of much feedback as to how I could have used the commands better. Which is great, I certainly do not have all the answers and I love to see the way others do things.

To that end I offering $100USD to the best improvement to this script, httpClient.sh. I have always wanted a pure BASH http client and thus I put this together last night. Its not perfect, some things are screaming to be fixed. In addition some other features should be added.

The rules:

  1. Your work MUST be original.
  2. Your work MUST be derived from the script above.
  3. It CAN NOT use netcat (nc).
  4. It MUST be submitted to me via email to this address:.
  5. The script must contain, as comments, your name, email, and website (if you have one).
  6. It MUST be submitted by March 7th at midnight CST.
  7. Also NOTE that BASH must be compiled with networking support to use the script. I believe most distributions do this, Debian apparently does not.

I will judge based on the following in no particular order. There is no need to fix them all, the winner may just fix one, in a really cool way:

  • I would like to see it exit with an error status when the server responds with an error.
    Meaningful exit status?
  • Handling white space better.
  • Storing the headers in an array.
  • Following the HTTP 1.1 RFC more. (HEAD with meaningful exit codes?)
  • Adding an option to save headers to a file.
  • Sometimes 0 is printed after the HTML, not sure why.
  • f19 is printed before the HTML when grabbing google, not sure why.
  • User agent
  • I had to institute a timeout on read otherwise it took 3-5 seconds to timeout. I’d like this handled better.
  • I am not sure what happens when you download binary data or large files.
  • Better ways of handling things, novel practices, clean code, and of course my opinion.

Chris FA Johnson won with this version of httpClient.sh! Congratulations Chris!