zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: what does 'interactive' mean?
Date: Tue, 10 Aug 2021 12:00:01 -0700	[thread overview]
Message-ID: <CAH+w=7a+gRxiPDdrxjFRamefrr4eDFUdHXQgYgLLe8+GQKis5A@mail.gmail.com> (raw)
In-Reply-To: <529da2fd-0718-847a-c939-63ce4d48b9ec@eastlink.ca>

On Tue, Aug 10, 2021 at 9:48 AM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> Just when I thought I understood it :-(  So 'non-interactive' might be
> interactive after all?  It would take some writing skill to really
> elucidate this.

You're WAY over-thinking this.

Computer operations are called "interactive" when they in some way
respond to user input, be that via keyboard, mouse, voice command,
electrodes on the skull, etc. as part of normal operation.

A shell is a command interpreter.  When the shell is described as
"interactive", that is intended to mean that the interpreter itself
responds to user input, for example by printing a prompt and waiting
in between interpreted commands or when a command is incomplete.
That's distinct from any of the commands executed BY the interpreter
doing something similar; that is, just because you can write a script
that invokes the "read" builtin with consequentially a prompt and a
wait for input, doesn't make the interpreter interactive, it just
makes your script interactive.

There are two ways this can get muddied:
(1)  Shell options such as INTERACTIVE and SHIN_STDIN can be forced on
at the command line, which may cause the interpreter to behave AS IF
it is receiving user input even when it is not.
(2) The design of the file descriptor system is such that a device
that interacts with the user can be substituted for almost any other
input, so the interpreter can be caused to receive user input even
when it does not "expect" to behave in an interactive manner.
"Interactions" such as exiting on a keyboard interrupt are a special
case of this: it's not the shell but instead the interactive device
(terminal) that receives the keyboard input, and translates it into a
signal which is delivered by the operating system.  This does NOT make
for an "interactive shell".

Roman is making an effort to quash the documentary imprecision when
describing the cases in which the interpreter behaves (or not) as if
it is receiving user input (no matter whether it actually is, or it
has been forced into that behavior).  There's really no useful way to
explain (2) within the documentation of the shell.


  reply	other threads:[~2021-08-10 19:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  2:58 Roman Neuhauser
2021-08-10  9:04 ` Thomas Paulsen
2021-08-10 13:00   ` Roman Neuhauser
2021-08-10 12:12 ` Peter Stephenson
2021-08-10 13:47   ` Roman Neuhauser
2021-08-10 13:54     ` Peter Stephenson
2021-08-10 15:30   ` Ray Andrews
2021-08-10 16:34     ` Peter Stephenson
2021-08-10 16:48       ` Ray Andrews
2021-08-10 19:00         ` Bart Schaefer [this message]
2021-08-10 22:33           ` Ray Andrews
2021-08-10 19:30         ` Lawrence Velázquez
2021-08-10 22:38           ` Ray Andrews
2021-08-10 23:08             ` Bart Schaefer
2021-08-10 23:26               ` Ray Andrews
2021-08-10 23:30                 ` Bart Schaefer

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='CAH+w=7a+gRxiPDdrxjFRamefrr4eDFUdHXQgYgLLe8+GQKis5A@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=rayandrews@eastlink.ca \
    --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).