Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Portably checking for shell level
- X-seq: zsh-users 7876
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Portably checking for shell level
- Date: Tue, 17 Aug 2004 14:31:23 -0700 (PDT)
- In-reply-to: <20040817185940.GA32231@DervishD>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040817185940.GA32231@DervishD>
- Reply-to: zsh-users@xxxxxxxxxx
On Tue, 17 Aug 2004, DervishD wrote:
> I have a shell script that cannot be sourced, because it must be
> run in a clean environment. Under zsh I achieve this using 'emulate
> -L zsh', or just by checking '$SHLVL' if the script won't run just by
> defaulting the ZSH options. The problem is: how to do this portably?
Try examining the value of "$-". That's not foolproof, but at least it
can tell you whether someone is "."-ing your script into an interactive
shell.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author