Nixers Book Club - Book #1: The UNIX Programming Environment - Community & Forums Related Discussions

Users browsing this thread: 1 Guest(s)
Long time nixers
It's time to bump this thread.
How was your week? Have you have a good reading?

The first exercise of the chapter present us with three different ways of passing a text to a utility. And gives us the following quote about the “cat abuse”:

Quote:Over the years the redirection operator < has lost some ground to pipes; people seem to find “cat file |” more natural than “<file”.

[Image: catabuse.png]

One thing I hadn't noticed is that when no files match a pattern with metacharacters, the shell passes the string on as through it had been quoted.

A digression on echo.
I once posted a thread about this very text and how most implementions that use getopt(3) on other utilities should not use it on echo(1):

The chapter also presents pick(1), a program to interactivelly select entries from stdin.
pick(1) will be implemented in later chapters.
Modern implementations of pick(1) exist, and I recommend you to use:

By the time of the book, there was no $() for using the output of a command, only ``.
I have no idea how they would do nested $() with backticks.

Redirections can occur anywhere on the command.
$ echo Hello World >/tmp/junk
is the same as
$ >/tmp/junk echo Hello World

This was also the case for environment variable assignment.
But since it interfered with dd(1), variable assignments are only accepted at the beginning.
(dd(1) (and find(1)) is such an alien command with its different syntax)

The chapter doesn't explain about the <> redirection. I don't know if this redirection existed back in the day, but it is very handy. I use it to make xnotify(1) read and write on the standard input, which is a pipe, so it doesn't get EOF when a program closes this pipe.

On the chapter on filters, I was introduced to comm(1), which I didn't know about.
The three grep(1)s are also introduced. IIRC, plan 9 only has one, with the structural regexps.

Messages In This Thread
RE: Nixers Book Club - Book #1: The UNIX Programming Environment - by seninha - 28-11-2020, 11:14 AM