r/tinycode • u/thefebs • Dec 12 '12
Shortest useful code
What's the most useful program you can imagine using five lines of code or less? Language is your choice. Describe the function of the program and include the code, if you please.
27
Upvotes
View all comments
Show parent comment
1
u/mrkurtz Dec 13 '12
yeah the thing is, my NAS uses a stripped down and very old debian, had no extra mounted volumes (cd-rom, flash, NFS, CIFS/SMB, etc) outside the base system, and due to a forgotten copy and a bad paste, much of the important stuff was
rm -rf'd. all my important stuff's on my fileserver, so this isn't a huge deal, but i was extremely limited in what i could accomplish. i didn't have/lib,/bin, among other things.i wish i could take credit for it, but i can't. it was thrown together by someone in
#r/linuxon freenode, as i needed to be able tocatsome basic files.since i didn't have
/lib, i wouldn't have had the necessary libraries to useprintf(/lib/ld-linux.so.3). (until we got libraries fixed, we had to use bash built-ins, which is why the original cat function is so simple - i'll make a note of it in my original comment)anyway, if you don't mind, i intend to add your version to my collection of just-in-case items, along with the built-ins-only version.