zsh-users
 help / color / mirror / code / Atom feed
* $_tty is gone after system upgrade
@ 2022-09-25 15:32 Ray Andrews
  2022-09-25 15:42 ` Roman Perepelitsa
  0 siblings, 1 reply; 4+ messages in thread
From: Ray Andrews @ 2022-09-25 15:32 UTC (permalink / raw)
  To: Zsh Users

I'm upgrading my system from Debian 9 to Debian 11 and my zsh is now 
whatever Debian installed (vs. old system where I was running Roman's 
pre-build). Prompt is:

     PS1=$'\n$_tty $_yel%d $_mag$cc$_nrm $ '

... which returned just the number of the current terminal on the old 
system but now

     $ echo $_tty

... returns nothing.

     $ echo $TTY

... shows " /dev/pts/3 " and of course I can strip that down to just the 
number, but still it seems strange that " $_tty " is gone.  What's the 
story?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: $_tty is gone after system upgrade
  2022-09-25 15:32 $_tty is gone after system upgrade Ray Andrews
@ 2022-09-25 15:42 ` Roman Perepelitsa
  2022-09-25 15:51   ` Ray Andrews
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Perepelitsa @ 2022-09-25 15:42 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sun, Sep 25, 2022 at 5:33 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> I'm upgrading my system from Debian 9 to Debian 11 and my zsh is now
> whatever Debian installed (vs. old system where I was running Roman's
> pre-build). Prompt is:
>
>      PS1=$'\n$_tty $_yel%d $_mag$cc$_nrm $ '
>
> ... which returned just the number of the current terminal on the old
> system but now
>
>      $ echo $_tty
>
> ... returns nothing.

I don't recall any version of zsh setting _tty. Debian 9 doesn't set it either.

    % docker run -e TERM --rm -it debian:stretch bash -c '
      apt-get update && apt-get install -y zsh && zsh -c "typeset -p TTY _tty"'
    [...]
    zsh:typeset:1: no such variable: _tty
    typeset TTY=/dev/pts/0

If you were using https://github.com/romkatv/zsh-bin, that would be
zsh 5.8. It doesn't set _tty.

In any case, it seems better to use ${TTY:t} given that this parameter
is (and has been for a long time) documented and working as intended.

Roman.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: $_tty is gone after system upgrade
  2022-09-25 15:42 ` Roman Perepelitsa
@ 2022-09-25 15:51   ` Ray Andrews
  2022-09-25 17:09     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Ray Andrews @ 2022-09-25 15:51 UTC (permalink / raw)
  To: zsh-users

On 2022-09-25 08:42, Roman Perepelitsa wrote:
>
> I don't recall any version of zsh setting _tty. Debian 9 doesn't set it either.
Ah!  Dumb question, it was my own variable.  I have this:

     if [[ $TERM == 'xterm' ]]; then

         _tty="${TTY#/dev/pts/}"

... but what's changed is the $TERM used to be "xterm" but is now 
"xterm-256color"  so that's where the problem is.  Easy to fix.

Do we have some way of erasing a question entirely from the site?  A 
question like this one shouldn't even have been asked, it's just 
pollution.  Thanks Roman.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: $_tty is gone after system upgrade
  2022-09-25 15:51   ` Ray Andrews
@ 2022-09-25 17:09     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2022-09-25 17:09 UTC (permalink / raw)
  To: zsh-users

On Sun, 2022-09-25 at 08:51 -0700, Ray Andrews wrote:
> On 2022-09-25 08:42, Roman Perepelitsa wrote:
> > 
> > I don't recall any version of zsh setting _tty. Debian 9 doesn't set it either.
> 
> Ah!  Dumb question, it was my own variable.  I have this:
> 
>      if [[ $TERM == 'xterm' ]]; then
> 
>          _tty="${TTY#/dev/pts/}"
> 
> ... but what's changed is the $TERM used to be "xterm" but is now 
> "xterm-256color"  so that's where the problem is.  Easy to fix.
> 
> Do we have some way of erasing a question entirely from the site?  A 
> question like this one shouldn't even have been asked, it's just 
> pollution.  Thanks Roman.

Actually, I disagree --- I think a reminder that names of terminals change
and that that may have consequences for shell code is very useful.

pws




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-25 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 15:32 $_tty is gone after system upgrade Ray Andrews
2022-09-25 15:42 ` Roman Perepelitsa
2022-09-25 15:51   ` Ray Andrews
2022-09-25 17:09     ` Peter Stephenson

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).