zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: can we detect the closing of a terminal?
Date: Sat, 05 Sep 2015 07:27:19 -0700	[thread overview]
Message-ID: <55EAFBC7.2080208@eastlink.ca> (raw)
In-Reply-To: <CABx2=D8Kgoe2wur255SOk-JOJVXOQKkzzK3W+7daM1c86-zJtw@mail.gmail.com>

On 09/04/2015 09:31 PM, Kurtis Rader wrote:
> ...

> Xterm does not "come with a zsh shell pre loaded". The xterm program by
> default runs whatever program is referred to by your SHELL environment
> variable.
I know.  Sorry, I expressed that poorly.  I just mean that as my machine 
is set up, SHELL is in fact zsh, so when I open an xterm I get a new zsh 
for that reason.  It could be otherwise, but isn't.

> ...
> SHELL=/bin/sh
> xterm
>
> You should get an xterm "terminal" that displays a Bourne shell prompt
> rather than your Zsh prompt. After exiting the xterm you just created
> you'll want to run
Yup, I know that too.  I've used it to explore compatibility issues.

> Lastly, you say that
>
> each terminal has an associated variable 't[number of the terminal]' set to
>> its $PWD
> That is not true.
Well, it is true because I make it so.

> The device path name for stdin and stdout of an
> interactive shell depends on both the operating system and how it was
> invoked. It might be /dev/pts/2 or /dev/tty or /dev/argle/bargle. You are
> using premises that only hold true for the very constrained situation of
> interest to yourself today. If you upgrade your operating system tomorrow
> (or switch to a different UNIX like OS or a non UNIX like OS) there is a
> strong possibility that your scripts will break.
Sure.  As you say, I'm constrained in my tiny world doing what works 
locally, and that is satisfactory for my current projects.  One wants as 
much universality as possible of course, and as I learn more, more 
robust code becomes possible.  Meanwhile I crash into gottchas all the 
time, but I guess that's how one learns--you don't know what you don't 
know.  Even worse, you don't know that most of what you do know is wrong.

BTW, it seems I can solve my problem very simply:

c--------- 1   5,  2 2015-09-04_23:48:38 /dev/pts/ptmx
crw--w---- 1 136,  0 2015-09-05_06:49:41 /dev/pts/0
crw--w---- 1 136,  2 2015-09-05_06:49:41 /dev/pts/2
crw--w---- 1 136,  3 2015-09-05_06:49:41 /dev/pts/3
crw--w---- 1 136,  4 2015-09-05_06:49:41 /dev/pts/4
crw--w---- 1 136,  7 2015-09-05_06:49:41 /dev/pts/7
crw--w---- 1 136,  6 2015-09-05_06:49:41 /dev/pts/6
crw--w---- 1 136,  8 2015-09-05_06:49:41 /dev/pts/8
crw--w---- 1 136,  9 2015-09-05_06:49:41 /dev/pts/9
crw--w---- 1 136, 10 2015-09-05_06:49:41 /dev/pts/10
crw--w---- 1 136, 11 2015-09-05_07:08:02 /dev/pts/11
crw--w---- 1 136, 12 2015-09-05_07:08:05 /dev/pts/12
crw--w---- 1 136,  5 2015-09-05_07:09:28 /dev/pts/5
crw--w---- 1 136,  1 2015-09-05_07:17:57 /dev/pts/1

... whenever a terminal closes, it's 'handle' above disappears so if, 
say '$t12' is set but '/dev/pts/12' does not exist, that flags the 
problem. So one of those semi-miraculous string comparisons is in order.



  reply	other threads:[~2015-09-05 14:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-30 19:13 zsh 5.1 released [user] Peter Stephenson
2015-09-04 16:02 ` can we detect the closing of a terminal? Ray Andrews
2015-09-04 17:09   ` ZyX
2015-09-04 21:37   ` Kurtis Rader
2015-09-05  3:07     ` Ray Andrews
2015-09-05  4:31       ` Kurtis Rader
2015-09-05 14:27         ` Ray Andrews [this message]
2015-09-06 16:43 ` zsh 5.1 released [user] Ray Andrews
2015-09-06 16:55   ` Axel Beckert
2015-09-06 16:57     ` Axel Beckert
2015-09-06 17:13       ` Ray Andrews
2015-09-06 19:37         ` Axel Beckert
2015-09-06 19:58           ` Ray Andrews
2015-09-08  1:55             ` Ray Andrews
2015-09-06 17:08     ` Ray Andrews
2015-09-06 16:50 ` syntax question Ray Andrews

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=55EAFBC7.2080208@eastlink.ca \
    --to=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).