Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Test if parameter is set
- X-seq: zsh-users 15965
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: Re: Test if parameter is set
- Date: Tue, 19 Apr 2011 18:26:41 +0100
- In-reply-to: <iokedv$c96$1@dough.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <iokedv$c96$1@dough.gmane.org>
On Tue, 19 Apr 2011 18:48:57 +0200
Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx> wrote:
> how can I test if a parameter is set?
if (( ${+VAR} )); then
...
is the zsh-specific answer. However, you can do this in a more standard
way, should you wish, with
if [[ -n ${VAR+1} ]]; then
...
(note no ":").
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author