26
netikras
25d

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

Proof in the comments

Comments
  • 5
  • 4
  • 3
  • 2
    @Demolishun it's not shell :) it's a full-blown programming language with tens of megs of packages
  • 5
    @netikras I wanna see the gihug/gitlab page on this.
  • 1
  • 2
    #/bin/bash
    php -S localhost:8080
  • 2
    @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
  • 3
    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.
  • 3
    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
  • 2
  • 3
    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.
  • 3
    @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!
  • 1
    If you didn't use netcat, then what are we even doing here?
  • 1
    @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
  • 3
    @bahua Who said I didn't :)
  • 5
    @theKarlisK There
    https://gitlab.com/netikras/bhttp

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

    I figured you did. I just wanted to be the one who guessed first.
  • 2
    so when do we get to ACE it? :D
  • 4
    Bah. Take your upvote, you impressive bastard ;)
  • 1
    @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 :)
  • 1
    @netikras

    donk="piss off, world!"

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

    echo $donk
  • 1
    @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