zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "C. v. Stuckrad" <stucki@math.fu-berlin.de>,
	Zsh hackers list <zsh-workers@math.gatech.edu>
Subject: Re: ((Re: set -vx changes output of)) subshells
Date: Sun, 9 Feb 1997 18:21:49 -0800	[thread overview]
Message-ID: <970209182149.ZM7964@candle.brasslantern.com> (raw)
In-Reply-To: "C. v. Stuckrad" <stucki@math.fu-berlin.de> "((Re: set -vx changes output of)) subshells" (Feb  9, 11:45pm)

On Feb 9, 11:45pm, C. v. Stuckrad wrote:
} Subject: ((Re: set -vx changes output of)) subshells
}
} On Wed, 5 Feb 1997, Daniel Dignam wrote:
} >    My assumption was that the set -vx didn't get inherited by the
} > subshells, but my understanding would appear to be false, I guess $()
} > isn't really a subshell ...
} 
} Well, This reminds me of a question I never could get solved so far:
} 
} How, if it is at all possible, can a $(...) subshell or the inside of a
} construct 'know' that is not '*THE* interactive' shell ?

It is true that there is no guaranteed way to discover that you are in a
subshell.  However, both `monitor' and `zle' become unset when entering
a subshell, so if you normally set either of those, `[[ -o monitor ]]' or
`[[ -o zle ]]' will become false when you've entered a subshell.

Inside $(...), `[[ -t 1 ]]' will detect that the output isn't a terminal.

} Simple but irritating (for me) exammple:
} 
} Assume you make a function 'xswt' which sets Window titles in X11-Xterms.
} Then you include 'xswt' inside of chpwd, so it gets executed at every 'cd'

The solution to this *specific* problem is to put `xswt' in preprompt(),
not in chpwd().

You should probably test `[[ -t 1 ]]' in `xswt' even so, in case somebody
calls it directly.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


      reply	other threads:[~1997-02-10  2:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-28  8:37 set -vx changes output of subshells Daniel Dignam
1997-02-05 15:06 ` Peter Stephenson
1997-02-05 15:32   ` Daniel Dignam
1997-02-09 22:45     ` ((Re: set -vx changes output of)) subshells C. v. Stuckrad
1997-02-10  2:21       ` Bart Schaefer [this message]

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=970209182149.ZM7964@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=schaefer@nbn.com \
    --cc=stucki@math.fu-berlin.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).