The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: ralph@inputplus.co.uk (Ralph Corderoy)
Subject: [TUHS] redirection wildness in v7
Date: Thu, 09 Nov 2017 15:04:56 +0000	[thread overview]
Message-ID: <20171109150456.7D0B1203B0@orac.inputplus.co.uk> (raw)
In-Reply-To: <3c417dcc-d3b4-0128-737a-7e510c6d0ffc@gmail.com>

Hi Will,

> Why does the first of these incantations not present text, but the
> second does (word is a file)? Neither errors out.
>
> $ <word | sed 20q
> $ <word sed 20q

That's still the case with modern-day sh(1).

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01
explains that a simple command doesn't need to result in a command name
to execute.  In your first pipeline, there's nothing to copy the data
from the first subshell's stdin redirected from ./word to the subshell's
stdout that's pipes into sed's stdin.  Adding a command to do the copy
works.

    <word cat | sed 20q

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy


  reply	other threads:[~2017-11-09 15:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 14:34 Will Senn
2017-11-09 15:04 ` Ralph Corderoy [this message]
2017-11-09 15:38   ` Will Senn
2017-11-20 23:38     ` Ralph Corderoy
2017-11-09 15:30 ` Chet Ramey
2017-11-09 21:36   ` Dave Horsfall
2017-11-09 21:39     ` Chet Ramey
2017-11-09 15:30 ` Dan Cross
2017-11-09 15:42   ` Will Senn

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=20171109150456.7D0B1203B0@orac.inputplus.co.uk \
    --to=ralph@inputplus.co.uk \
    /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.
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).