Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh Guide chapter 5 (substitutions)

On Aug 16, 12:00am, Peter Stephenson wrote:
} Subject: Zsh Guide chapter 5 (substitutions)
} The main addition is chapter 5, which talks about all forms of shell
} substitutions and expansions.  Chapter 3 has been slightly edited.  I'd
} be interested in any comments on either, of course.  It's possible
} chapter 3 is a little indigestible and I could move some of the
} marginalia to a later chapter or appendices or whatever.

Here's something I noticed in Chapter 3:

  ./myscript 2> >(grep -v idiot >error.log) |
       process-output >output.log

a little abstract, but here the main point of the script `myscript'
is to produce some output which undergoes further processing on the
right-hand side of the pipe. However, we want to process the error
output here, by filtering out occurrences of lines which use the word
`idiot', before dumping those errors into a file error.log. So we get an
effect similar to having two pipelines at once, one for output and one
for error. Note again the two `>' signs present next to one another to
get that effect. Don't remove the space between them, either: for what
that will do, and for more on the meaning of `2>', see the section on
redirections, below.

I don't know what you're driving at, there.  2>>(thing) and 2> >(thing)
are exactly equivalent.  However, 2>(thing) is the same as 2 >(thing),
and not the same as 2> (thing), which is a syntax error that I've never
seen before in ten years of using zsh ("missing end of name").

I may have some remarks about chapter 5 when I get there ...

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

Messages sorted by: Reverse Date, Date, Thread, Author