Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ((Re: set -vx changes output of)) subshells
- X-seq: zsh-workers 2883
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: "C. v. Stuckrad" <stucki@xxxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxxxxxxxxxx>
- Subject: Re: ((Re: set -vx changes output of)) subshells
- Date: Sun, 9 Feb 1997 18:21:49 -0800
- In-reply-to: "C. v. Stuckrad" <stucki@xxxxxxxxxxxxxxxxx> "((Re: set -vx changes output of)) subshells" (Feb 9, 11:45pm)
- References: <Pine.GSO.3.95q.970209232720.23982B-100000@petzval>
- Reply-to: schaefer@xxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author