zsh-users
 help / color / mirror / code / Atom feed
From: "Radoulov, Dimitre" <cichomitiko@gmail.com>
To: zsh-users@zsh.org
Subject: Re: exec - interactive vs non-interactive shell
Date: Thu, 02 Jun 2011 11:37:11 +0200	[thread overview]
Message-ID: <4DE759C7.6070004@gmail.com> (raw)
In-Reply-To: <op.vwfxxconnba3tw@pwspc01.europe.root.pri>

On 02/06/2011 10:59, Peter Stephenson wrote:
> On Wed, 01 Jun 2011 23:03:23 +0100, Radoulov, Dimitre 
> <cichomitiko@gmail.com> wrote:
>> On 01/06/2011 22:42, Peter Stephenson wrote:
>>> On Wed, 01 Jun 2011 21:55:04 +0200
>>> "Radoulov, Dimitre"<cichomitiko@gmail.com>  wrote:
>>>> zsh-4.3.11[t]% cat a_script
>>>> exec cat
>>>> ok
>>>> zsh-4.3.11[t]%
>>>>
>>>>
>>>> zsh-4.3.11[t]% zsh<   a_script
>>>> ok
>>> So cat has taken over stdin, as expected.
>>>
>> ash, dash and bash, for example, behave differently (ksh and variants 
>> seem to behave like zsh).
>> Do you know if this behavior is defined by the POSIX standard?
>
> I suppose this is down to the behaviour of exec.  I didn't see anything
> in the standard about what it should do with stdin when the current
> shell was replaced with no additional redirection.
>
> I think what's happened is probably that the shells that don't show
> you anything have read ahead, so you still keep stdin from the same
> place, but you don't necessarily get the very next line.  I suspect
> this behaviour isn't defined.  (If that's right, then zsh's and ksh's
> behaviour is the philosophically correct one, but there are
> extenuating circumstances for the others.)
>
>> If the shell is interactive, there's no script name nor explicit 
>> input redirection (<) ,
>> command and standard input come from the same channel too (the 
>> terminal),
>> or I'm missing something?
>
> You're not fundamentally missing anything, no, I deliberately glossed
> over the way the shell opens the terminal.  It is based on stdin,
> but in practice the shell duplicates the file descriptor and does
> its terminal processing on a hidden one (i.e. greater than 9).
>

Thanks again!


Best regards
Dimitre


      reply	other threads:[~2011-06-02  9:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 19:55 Fwd: " Radoulov, Dimitre
2011-06-01 20:42 ` Peter Stephenson
2011-06-01 22:03   ` Radoulov, Dimitre
2011-06-02  8:59     ` Peter Stephenson
2011-06-02  9:37       ` Radoulov, Dimitre [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=4DE759C7.6070004@gmail.com \
    --to=cichomitiko@gmail.com \
    --cc=zsh-users@zsh.org \
    /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).