zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Martijn Dekker <martijn@inlv.org>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Checking if a variable is exported
Date: Fri, 21 Oct 2016 23:12:22 +0200	[thread overview]
Message-ID: <CAHYJk3RNDnCr4m=rwdK=R1FyNYovUuEpBL6UdD-GwkWipQ8PAA@mail.gmail.com> (raw)
In-Reply-To: <032fd4ec-89c1-9dae-a729-c440048ff3ec@inlv.org>

On Fri, Oct 21, 2016 at 10:27 PM, Martijn Dekker <martijn@inlv.org> wrote:
> Hi all,
>
> Does zsh have a straightforward way for a script to check if a variable
> is exported? The closest-to-straightforward way I know of is to parse
> the output of 'typeset -p varname', which is hairy because the output
> might include various options to the command.

${(t)param} will contain "export".

-- 
Mikael Magnusson


      parent reply	other threads:[~2016-10-21 22:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 20:27 Martijn Dekker
2016-10-21 21:00 ` Eric Cook
2016-10-21 21:06 ` Nikolay Aleksandrovich Pavlov (ZyX)
2016-10-22  5:57   ` Bart Schaefer
2016-10-21 21:12 ` Mikael Magnusson [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='CAHYJk3RNDnCr4m=rwdK=R1FyNYovUuEpBL6UdD-GwkWipQ8PAA@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=martijn@inlv.org \
    --cc=zsh-users@zsh.org \
    /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).