1. 53
  1.  

  2. 23

    FOR THE LOVE OF…oh, this is actually pretty compact and readable.

    1. 9

      That’s surprisingly neat. I’d still choose C in most situations, but I guess the Bash version could be useful in some extreme environment where you don’t have access to a compiler…

      Oh I know: data exfiltration.

      1. 5

        Sadly real situations exist for some stuff: eg shared hosts. PHP, perl and shell are fine; getting access to a compiler requires support requests and is timed. Not all are like this, but my current site’s one (Zuver) is.

        EDIT: Host uses an old glibc, had issues compiling on my machine and uploading the binaries. Since had luck with something along the lines of musl-gcc -static -libc-static

        At one point I added a C program into my (sh) website backend. It split up HTTP multipart submissions into files with controlled filenames, so shell (or any language) manipulation could be easy afterwards. Eg for when submitting both text and image files via one POST. Decided to cull it and stick to simpler methods of getting pictures up.

      2. 1

        BTW Oil runs this now :)

        http://www.oilshell.org/blog/2020/03/recap.html#shell-features-and-milestones

        I implemented the -n feature