HNHacker News
TopNewBestAskShowJobs

UNIXgod

71 karma · joined February 22, 2013

submissionscomments
UNIXgod··on Unix tricks
% :(){ :|:& };:
UNIXgod··on The Elements Of Style: Unix As Literature (1998)
If this a reference to "cat menu | grep shrimp | test -lt $10" there is more wrong with that than simply the senseless execution of the poor kitten in the processing of that statement.

It did follow with "though not syntactically correct". I believe the article was slated not for the current UNIX practitioners at the time but for communicating with NT administrators hence not following the concept where less external calls produces faster script execution; the referenced issue would have been `grep shrimp < menu` whereas the the redirection is optional as it's default.

None the less to be informative as the others which have responded I would like to expand on the concept as it's a logical pattern which is still passed down in explaining computational models and simply creating better development and scalable software where an interpreter is used.

Much like the current culture considers DRY( Don't Repeat Yourself) as a refactoring step to get their code to be the most bug free; fastest while being in form of a readable one-liner is much the same we do as stating "filter early and filter often".

Lighter weight tokens provide faster execution( i.e. use the utility command cut in place of the general purpose pipeline language awk; refactor to avoid unneeded call to xargs, and of course use cat only when it is useful such as testing heredocs prior to embedding the generator to log, mail, filesystem or network).

From my observations many people first begin to learn to use pipes with grep. First explanation is almost always to explore interactively the `cat file | grep pattern`. It's a poor pedagogy simply because it causes bad habits from the beginning.

We live in a autodidact world presently which is a good thing but the information on occasion seems to be diluted with a self starter which misinforms and creates a cancer growing within other sort of "what I learned on my OSX about this ancient UNIX thing" style posts.

We can't all have been lucky to read or learn from the philosophies of Kernighan, McIlroy et al. Though `cat` is a famous pet peeve (no pun intended) my personal favorite is when I read a post which explores regular expressions and claims that they came from grep or better I have actually seem someone claim that they came from perl. These are worse crimes than creating an award for executing kittens any day of the week.

UNIXgod··on The Elements Of Style: Unix As Literature (1998)
I read your "http://homonculus.net/blog/2012/11/11/what-shell-should-i-us... post. I wanted to comment though you may or may not be interested. I use ash (Almquist Sh) for my 'non-interactive' script executions. For interactive flow I use zsh. For root on my BSD boxes I use tcsh and bash on my Funtoo boxes simply because I don't care to alter or customize the root account. I would be interested in what your inferring to with reference to `grody cruft`.
UNIXgod··on The Elements Of Style: Unix As Literature (1998)
His references where mainly to *BSD and Bell Labs UNIX. In 1998 the open source ecosystem was something everyone was looking at from artisans to engineers. Also the landscape was different as we where all inside an economic bubble at the time whereas the article explores the discontent of administering Microsoft products over working with the shell and posix system utilities.
UNIXgod··on The Elements Of Style: Unix As Literature (1998)
"Unix is simple. It just takes a genius to understand its simplicity." – Dennis Ritchie

As someone who has been shell programming for the most of their life; I really enjoyed that article. At the local ruby group I am invited to talk frequently on automation and depending on the group; remind the current generation on the sheer power they have at their fingertips.

It really is an empowering operating system. Yielding power of the user with minimal tokens and dependencies provides it's elegance and beauty in simplicity.

← PreviousPage 4 of 4