Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: When is STTY ignored?
- X-seq: zsh-workers 41182
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: When is STTY ignored?
- Date: Tue, 30 May 2017 07:53:02 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Q0GXEV3naZtw+zGHSCWIJrjDb+GO2BGPMvrUFSTF9xc=; b=PRr+k6E2PnDxya4Fw+T/mP284rbbEmVubw5BpMD0wT2yaQkZhJqDthEDg5n2sBMnY1 aTwFCmzOY90G/AGGUFKlayVz2CfXetdc1JTnT2jHhUIfp92U6Vzw4ss9K/XDsOa7RYQB rxTozAQsSU4KyYZEsuxq20SmijRnNxLKu6PftA5fTQiKMeffFCYjoQCw5GD5j1dp35Wn Ypc3hopdGLUX66Ah/xcKWdZCMbmBCSMSP1RvraYa28K/eLQsCPtwGQNWl1/l4AHddj9D ZWNcvErJivYZb3fAOs7graVlmceiDfli1E6j8vvu1850vn+2VYEzveUWIQo2T6LeHax/ w0vQ==
- In-reply-to: <170529170209.ZM30652@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170529203625.GA7664@chaz.gmail.com> <170529170209.ZM30652@torch.brasslantern.com>
2017-05-29 17:02:09 -0700, Bart Schaefer:
> On May 29, 9:36pm, Stephane Chazelas wrote:
> }
> } It's not very clear to me when one may use STTY.
>
> It applies only to external commands, not those executed within zsh
> (functions, loops, other multiline constructs, builtins).
>
> If it's in the environment of a function et al., it'll apply to all
> external commands run from within that construct.
Thanks. That doesn't seem to be the whole story though.
See the examples I gave
"line" is an external command. "eval" and "command" are builtin
commands.
STTY=-echo line
STTY=-echo command line
f() line; STTY=-echo f
Do work, but not
STTY=-echo eval line
About zsh -c, it looks like it "works" as long as there's only one
command:
zsh -c 'STTY=-echo line'
works (well, it doesn't seem to restore the settings afterwards)
but not
zsh -c 'STTY=-echo line; exit'
It seems it never works in scripts even if they contain a single
command. With scripts source from interactive shells, they seem
to "work" but don't restore the tty settings.
See also:
line | STTY=-echo wc -c
STTY=-echo head -n1 /dev/tty < /dev/null
which don't "work" (even if they called stty, stty would fail
because stdin is not a terminal anyway, but that would still be
worth documenting).
In:
(STTY=-echo line; STTY=-echo line); line
the "-echo" is only applied to the 2nd and 3rd "line"
invocations (instead of 1st and 2nd).
And the issue when several are stacked mentioned before:
$ f() STTY=-onlcr line; STTY=-echo f; stty
asd
asd
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8
-onlcr
-echo not applied, -onlcr not restored.
It would be worth documenting that it can only be used in
interactive shells and only for the simplest case of one simple
external command at the prompt, not in subshell, and without
stdin redirection
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author