From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17143 invoked by alias); 12 Sep 2014 23:21:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19078 Received: (qmail 24589 invoked from network); 12 Sep 2014 23:21:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140912162116.ZM23683@torch.brasslantern.com> Date: Fri, 12 Sep 2014 16:21:16 -0700 In-reply-to: <20140912200509.6cac2742@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: Detect if a script is being sourced vs executed" (Sep 12, 8:05pm) References: <541333FF.3090601@thequod.de> <20140912200509.6cac2742@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Detect if a script is being sourced vs executed MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 12, 8:05pm, Peter Stephenson wrote: } } I was surprised to find the zsh/parameter modules series of array } parameters that allow you to trace back the functions, sourced files, } etc. being executed don't give this information, which is present } internally. This adds $functypestack to do this. Is this in some way NOT redundant with $zsh_eval_context ? Other than apparently being in the reverse order? torch% source =(<<<'() { print $zsh_eval_context }') toplevel file shfunc torch% source =(<<<'() { zmodload zsh/parameter; print $functypestack }') function source