BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] SysVinit vs. systemd
- Subject: [Discuss] SysVinit vs. systemd
- From: bill.n1vux at gmail.com (Bill Ricker)
- Date: Thu, 11 Sep 2014 11:46:14 -0400
- In-reply-to: <e5ec0389fc274727af541fbdb18dd7a4@CO2PR04MB684.namprd04.prod.outlook.com>
- References: <5411058F.6010208@gmail.com> <e5ec0389fc274727af541fbdb18dd7a4@CO2PR04MB684.namprd04.prod.outlook.com>
On Thu, Sep 11, 2014 at 8:42 AM, Edward Ned Harvey (blu) <blu at nedharvey.com> wrote: > 1- For example, you can do something like > "find somedir -type f -exec grep -l somestring {} \;" > and this adheres to the above principles ... > So then the makers of grep realized they're getting thousands of new > processes spawned and wasting a lot of time, so now you can equivalently > do "grep -lr somestring somedir" which is simpler, more compact, easier to > read/write, and also much faster, because it's integrated. The original Bell Labs proponents of "do one thing well" accepted that an inefficient shell idiom exposed a new need for a new "one thing" to be done, and that the idiom was a prototype for a new feature that would "do" the new "one thing" "well". Indeed, Bell team added ls -srt quite early, as it was demonstrated as being needed (to avoid alias lss, lst, lssr, lsstr ...). Whether the needed new feature that is implemented as an added grep -r flag or a (hypothetical) find -grep flag or the 'ack' command is a separate matter of taste. (I recommend ack, but that's *my* personal taste. http://beyondgrep.com/ . If you never use real Unix, go ahead and get reliant upon Gnu extensions.) ( Tangential note: There is a "do one thing well" composite solution to find-grep performance too : find ... -print0 | xargs -0 ... is generally superior to find ... -exec ... ';' This can reduce number of spawns by factor of e.g. 900 to 3000 in a modern shell on modern kernel ! $ find . -type f -print0 | xargs -0 perl -E 'say $#ARGV;' # how many args per $ find . -type f -name '*.c' -print0 | xargs -0 grep -i '#include' # or whatever [ Sadly with Win/Mac inspired "spaces in file and directory name for human readability" conventions, the -0 is required for reliability, but find and xargs defaults were set when people knew not to do that. *sigh* ] ) I wonder which "makers of grep" added -r ? I'm guessing it was Team Gnu; it's not a POSIX flag[*]. The SysIII/V, BSD, and Gnu teams all added a lot of flag features to the core executables and built-ins, but Gnu team style is furthest removed from the "do one thing well" style of Bell Labs through v6, PWB, & v7. [*] http://pubs.opengroup.org/onlinepubs/009695399/utilities/grep.html -- Bill Ricker bill.n1vux at gmail.com https://www.linkedin.com/in/n1vux
- Follow-Ups:
- [Discuss] SysVinit vs. systemd
- From: michael.tiernan at gmail.com (Michael Tiernan)
- [Discuss] SysVinit vs. systemd
- References:
- [Discuss] SysVinit vs. systemd
- From: tmetro+blu at gmail.com (Tom Metro)
- [Discuss] SysVinit vs. systemd
- From: blu at nedharvey.com (Edward Ned Harvey (blu))
- [Discuss] SysVinit vs. systemd
- Prev by Date: [Discuss] SysVinit vs. systemd
- Next by Date: [Discuss] Boston Linux Meeting Wednesday, September 17, 2014 - Crypto News, TOR, and our PGP/GnuPG Keysigning Party XIV
- Previous by thread: [Discuss] SysVinit vs. systemd
- Next by thread: [Discuss] SysVinit vs. systemd
- Index(es):