21

Soo.. yeah.. I've just build a fully functional http webserver with BASH :) Yippee!!

Proof in the comments

Comments
  • 3
  • 2
  • 2
  • 1
    @Demolishun it's not shell :) it's a full-blown programming language with tens of megs of packages
  • 0
    @theKarlisK soon :)
  • 1
    #/bin/bash
    php -S localhost:8080
  • 0
    @ilikeglue nope.. I only use bash and one other tool that usually comes preinstalled with linux, along with the gnu toolset. Those are the only two binaries
  • 0
    The point of all my scripts is to have as little dependencies as possible to do the job. So that you could simply copy-paste them into any other machine as text and they would work.

    If any dependencies required - I pick them to be as standard to the barebones OS as possible.
  • 2
    Congratulations on the server, but did you just commented all the code in the comments followed by a special call for @highlight bot , followed by deleting your previously written text messages ?😆
  • 2
    @StopWastingTime
  • 1
    @StopWastingTime yepp.. Why?
  • 2
    It’s like doing PHP with IIS, or .Net with Apache. It is possible, but no one in their right mind should do that. Ever.
  • 1
    @NoToJavaScript but it's hell of a fun!

    Ofc noone in their tight mind would write ping-pong, json parser, threads-like parallel-execution engine, chat app, other stuff like that with bash.

    But I often do those things, because it's freaking fun, it's hell of a challenge and it makes you build efficient algorithms.

    Everyone can import a json parser lib in their projects. How many of you have built one? How many of you know how exactly they work? How many of you could make a functional analog in a very limited language, like bash?
    I doubt anyone would bother. It's a difficult challenge. And these are exactly the challenges I'm tripping from!

    Some people party to have fun. Others sky-dive. Some like rafting. I prefer shell scripting!
  • 0
    If you didn't use netcat, then what are we even doing here?
  • 0
    @netikras Python 3.8 is 25Megs for Windows installer. Also usually comes preinstalled in a lot of Linux distros. The python webserver is cross platform. I suppose you could run your bash server in Ubuntu shell in Windows?

    I just mostly wanted to poke the dragon...
  • 0
    @StopWastingTime
  • 2
    @bahua Who said I didn't :)
  • 3
    @theKarlisK There
    https://gitlab.com/netikras/bhttp

    Still a lot to do. But it does work already :)
  • 3
    @netikras

    I figured you did. I just wanted to be the one who guessed first.
  • 1
    so when do we get to ACE it? :D
  • 3
    Bah. Take your upvote, you impressive bastard ;)
  • 0
    @Demolishun How do I serve it my own content? I.e. how do I map "GET:/hello" with a response "hello world!" using `python -m http.server`?

    I surely don't want to be serving my files. I'd like dynamic content :)
  • 0
    @netikras

    donk="piss off, world!"

    date +%s | grep -qE "[24680]" && donk="hello world!"

    echo $donk
  • 0
    @bahua Sorry, I don't follow. Nor did I get the significance of that number nor can I figure out which comment you are replying to :) It surely doesn't look 'python', so please, help me out here :)
  • 1
    @netikras

    It was just some shell nonsense to create, "dynamic" output. I didn't know you were looking for python. I can't help with that.
  • 0
    @bahua aahh, I see now. That's why my comment was addressed to Demolishun ;) He was suggesting to use python instead
  • 0
    I'm interested in server.bash did you post it somewhere?
  • 1
    @hjk101 I did or or there 😁
  • 0
    @netikras 🤣 my cat was having an interest in the phone didn't see he did that. Prrr prr orr orr
  • 0
    @hjk101 your cat is quite an english speaker! What did it had in mind tho?
  • 0
    weird flex, but ok
Add Comment