Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirection (<>)
- X-seq: zsh-users 1708
- From: "Owen M. Astley" <oma1000@xxxxxxxxx>
- To: Jan Kroken <jankr@xxxxxxxxxx>
- Subject: Re: Redirection (<>)
- Date: Fri, 7 Aug 1998 17:00:40 +0100 (BST)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <vhipvecu8dh.fsf@xxxxxxxxxxxxxxxxx>
- Sender: Owen Astley <oma1000@xxxxxxxxxxxxx>
> >From zsh.info:
> `<>WORD'
> Open file WORD for reading and writing as standard input. If the
^^^^^^^^^^^^^^
> file does not exist then it is created.
>
> and here's what happens when I try to use it.
>
> ~/tmp% cat > f
> a b d f
> c d c
> c c d
> e c d
> ~/tmp% sed "s/c/f/g" <> f
> a b d f
> f d f
> f f d
> e f d
> ~/tmp% cat f
> a b d f
> c d c
> c c d
> e c d
> ~/tmp%
>
> And my question is; Why does the output from sed go to stdout?
>
> What does <> really mean?
It means that the file is opened rw as stdin (instead of read-only, as
normal). sed sends its output to stdout.
If you had a program that tried to write to stdin it would normally fail
(presumably), but wouldn't if you used <>.
(Note: I haven't tried this).
Owen
Messages sorted by:
Reverse Date,
Date,
Thread,
Author