zsh-users
 help / color / mirror / code / Atom feed
From: "Owen M. Astley" <oma1000@cam.ac.uk>
To: Jan Kroken <jankr@ifi.uio.no>
Cc: zsh-users@math.gatech.edu
Subject: Re: Redirection (<>)
Date: Fri, 7 Aug 1998 17:00:40 +0100 (BST)	[thread overview]
Message-ID: <Pine.OSF.3.96.980807165844.1990O-100000@alpha2.poco.phy.cam.ac.uk> (raw)
In-Reply-To: <vhipvecu8dh.fsf@thjazi.ifi.uio.no>

> >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



      parent reply	other threads:[~1998-08-07 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-07 15:19 Jan Kroken
1998-08-07 15:52 ` Zefram
1998-08-07 16:00 ` Owen M. Astley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.OSF.3.96.980807165844.1990O-100000@alpha2.poco.phy.cam.ac.uk \
    --to=oma1000@cam.ac.uk \
    --cc=jankr@ifi.uio.no \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).