Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Request: a way to get the subshell level nesting
- X-seq: zsh-workers 25625
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Rocky Bernstein <rocky.bernstein@xxxxxxxxx>
- Subject: Re: Request: a way to get the subshell level nesting
- Date: Fri, 5 Sep 2008 12:49:13 -0700
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=SsSyr6IP2+P8xomxzZoZ/fMCG5MdyFOPLhP9DvsezhXgjoW1qh+G0XGVTwDbypAh78kjYu4v4YlPt3Kw7dRwI4Em4FD3UWe+boyORZCnpbfSHwRMDmPIupBFVLen8f9CySHQScGtSyA9e0fNuEW17VGR1BjmLGIj3T8XZsS+s6g=;
- In-reply-to: <6cd6de210809050711h4811efei413630fb514333ae@xxxxxxxxxxxxxx>
- Mail-followup-to: Rocky Bernstein <rocky.bernstein@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <6cd6de210809050711h4811efei413630fb514333ae@xxxxxxxxxxxxxx>
On 2008-09-05 at 10:11 -0400, Rocky Bernstein wrote:
> It would be great if there were a way to get the subshell level nesting. ksh
> uses .sh.level and bash BASH_SUBSHELL.
I don't think zsh has that directly as a variable, but it does have %_
for prompt substitution, producing on stdout a list of words identifying
the nested parser states. It's output text, not a data structure
internal to the shell (so not an array).
zsh% for i in 1; do if [[ x == x ]]; then print -P %_ ; fi; done
for then
zsh%
Of course, capturing that in $(...) will add a cmdsubst to the end.
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author