zsh-users
 help / color / mirror / code / Atom feed
From: Matt Zagrabelny <mzagrabe@d.umn.edu>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: inconsistency between bash and zsh subshells
Date: Mon, 23 May 2022 12:51:44 -0500	[thread overview]
Message-ID: <CAOLfK3V9nx0fWu1xDyd+H3X2pz+epMz1fM5VR2-oW=xmJ9jWMg@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3S4Rw=SRGNcrWjvMjZx0J9_PEUxh25nGm4iZ5Rww7-WnQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On Mon, May 23, 2022 at 12:32 PM Mikael Magnusson <mikachu@gmail.com> wrote:

> On 5/23/22, Matt Zagrabelny <mzagrabe@d.umn.edu> wrote:
> > On Mon, May 23, 2022 at 12:01 PM Mikael Magnusson <mikachu@gmail.com>
> > wrote:
> >
> >> On 5/23/22, Matt Zagrabelny <mzagrabe@d.umn.edu> wrote:
> >>
> >> > Why does the subshell in zsh get executed even though the conditional
> >> > branch is not? That is, the "touch"-ing of /tmp/FOO.
> >>
> >> You're most likely using a poorly written prompt theme and/or thing
> >> that updates your terminal title.
> >
> >
> > Haha. Probably!
> >
> >
> >
> >> Try disabling that code and try
> >> again if so.
> >>
> >
> > Yup - that was it. I removed my .zshrc and it works as expected.
> >
> > Thanks for the hint! Time to figure out what poorly written part of my
> > .zshrc is to blame.
>
> It will probably be something involving print -P and \a or \007 in
> something named preexec. If you change $1 in that to \$1 it is more
> likely to work,


Probably = 100% likely.


> though it's of course hard to say without seeing the
> particular code.


For fun, and full disclosure, here is the code:

preexec () {
    case $TERM in (xterm*|screen*|tmux*|rxvt)
        print -Pn "\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%y : $1\a"
    esac
}

to which I've changed $1 to \$1 and it fixes the issue.

Thanks for the help, Mikael! It is very appreciated!

-m

[-- Attachment #2: Type: text/html, Size: 2407 bytes --]

  reply	other threads:[~2022-05-23 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 16:55 Matt Zagrabelny
2022-05-23 17:01 ` Mikael Magnusson
2022-05-23 17:26   ` Matt Zagrabelny
2022-05-23 17:31     ` Mikael Magnusson
2022-05-23 17:51       ` Matt Zagrabelny [this message]
2022-05-23 17:04 ` Dominik Vogt

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='CAOLfK3V9nx0fWu1xDyd+H3X2pz+epMz1fM5VR2-oW=xmJ9jWMg@mail.gmail.com' \
    --to=mzagrabe@d.umn.edu \
    --cc=mikachu@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).