FOR THE LOVE OF…oh, this is actually pretty compact and readable.
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.
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.
BTW Oil runs this now :)
I implemented the -n feature