Rewriting the GNU Coreutils in Rust
Rewriting the GNU Coreutils in Rust
Posted Jun 9, 2021 21:28 UTC (Wed) by rahulsundaram (subscriber, #21946)In reply to: Rewriting the GNU Coreutils in Rust by wahern
Parent article: Rewriting the GNU Coreutils in Rust
Why is this a problem? It is a easy toggle to turn on/off
Posted Jun 11, 2021 23:12 UTC (Fri)
by jccleaver (guest, #127418)
[Link] (1 responses)
Because a system administrator may spend lots of time iterating between executing command lines, writing those command lines into a shell script, and debugging said command lines.
Predictability is vitally important, especially if it's 3am and I'm trying to figure out why this shell script that had been working suddenly breaks in the script but works fine when executed by hand.
There's a reason code deltas for interactive operation were few and far between, and mostly invisible (eg, stripping color). When the utility didn't handle it, "standard" shell aliases (eg, "rm -i") could do the trick. Plenty of utilities in the last decade seem to think that I *always* want a huge, complex TUI for getting data, or think it knows better about how I want my output presented.
I have high confidence that grep in an interactive shell and grep in a shell script will do essentially the same thing (except for things that apply to all scripting, like proper handling of globs). I have little confidence a "modern" grep replacement won't have some weird hacky behavior that was put in because it looks cool and will cost me an hour of hair-pulling early in the am trying to track it down.
Posted Jun 12, 2021 3:17 UTC (Sat)
by rahulsundaram (subscriber, #21946)
[Link]
I suspect from your response that you haven't used rg.
I have written plenty of scripts using both grep and occasionally rg as part of my work and I consider either behavior very much predictable and documented. If anything grep behavior is slightly less predictable when switching between say a laptop running Mac and a server running Linux because of the variations between grep.
Rewriting the GNU Coreutils in Rust
Rewriting the GNU Coreutils in Rust