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

Re: <> redirection operator



(Sigh.  After half a dozen years of the mailing list sending replies to the
original sender, I'm still forgetting to change the address.)

Clint Adams wrote:
> > All this means is that fd 0 is O_RDWR rather than O_RDONLY.  It still
> > opens exactly one descriptor.
> 
> Ah.  What is the point of that?

To put it another way,

% echo test >/tmp/redirtest
% sed 's/e/Z/g' <>/tmp/redirtest 1>&0
% cat /tmp/redirtest
tZst

(This happens to work in place even on a mult-line file, but I think you
have to be pretty sure what you're doing to use it like that.  Finally I've
got an example of this for the user guide, anyway.)

It's just consistently applying the rule that one redirection redirects
exactly one file descriptor, and to do the other you need to do it
explcitly as above.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



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