3 ms·
There's another reason to reinvent the wheel: $ replace "Foo" "Bar" is common sense and easy to understand. Not to mention that sed -i is a GNU extensio
by readme 14y ago
There's another reason to reinvent the wheel:
$ replace "Foo" "Bar"
is common sense and easy to understand.
Not to mention that sed -i is a GNU extension.
I haven't used replace but it seems like a pretty innocent piece of helpful code for someone who likes JS.
- gilmeir 14y agoI agree and also I took a peek at the code and my eyes did not bleed... it's a nice little one-off that doesn't try to do too much and is written in a decent ad-hoc manner... what's wrong with that? Heather, you've created a nice and useful tool with a modern tool-set, did a very decent job coding it and took the time to open-source it. In my eyes at least it puts you in the top 0.01% of coders in the world.
- mpyne 14y agoI actually had something similar myself, a shell function called findRE, the entire purpose of which was to automate searching a given path recursively for a given regex. However I used it so infrequently that whenever the need would arise, I would invariably screw up the order of the 2 (only 2!) arguments. I could have added support for --help, --usage or similar, but that seemed like overkill. I eventually just learned how to "properly" use find and grep (both of which I was already using anyways, which helped me remember the command line for each). With that said I do agree that I'd never use shell script or Unix userland on purpose when writing scripts that are intended to be portable across different Unices (or even Windows), that's the kind of thing I'd reserve for personal use on my own userland. Hell, even on one machine you never know with some distributions what kind of shell you'll login to by default...
- deleted 14y ago[deleted]