On 5/23/22, Matt Zagrabelny <mzagrabe@xxxxxxxxx> wrote:
> On Mon, May 23, 2022 at 12:01 PM Mikael Magnusson <mikachu@xxxxxxxxx>
> wrote:
>
>> On 5/23/22, Matt Zagrabelny <mzagrabe@xxxxxxxxx> 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