[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to test if a variable is declared?
From: |
David |
Subject: |
Re: How to test if a variable is declared? |
Date: |
Fri, 13 Mar 2020 14:07:22 +1100 |
On Fri, 13 Mar 2020 at 13:59, Peng Yu <address@hidden> wrote:
> What is the best way
> to test whether a viable is declared?
Here's one way:
$ echo "$BASH_VERSION"
4.4.12(1)-release
$ unset v
$ declare -p v ; echo $?
bash: declare: v: not found
1
$ declare v
$ declare -p v ; echo $?
declare -- v
0
$
- How to test if a variable is declared?, Peng Yu, 2020/03/12
- Re: How to test if a variable is declared?,
David <=
- Re: How to test if a variable is declared?, Peng Yu, 2020/03/13
- Re: How to test if a variable is declared?, Andreas Kusalananda Kähäri, 2020/03/13
- Re: How to test if a variable is declared?, Peng Yu, 2020/03/13
- Re: How to test if a variable is declared?, Eli Schwartz, 2020/03/13
- Re: How to test if a variable is declared?, Peng Yu, 2020/03/13
- Re: How to test if a variable is declared?, Pier Paolo Grassi, 2020/03/13
- Re: How to test if a variable is declared?, Peng Yu, 2020/03/13
- Message not available
- Re: How to test if a variable is declared?, Peng Yu, 2020/03/13
- Re: How to test if a variable is declared?, David, 2020/03/13
- Re: How to test if a variable is declared?, Andreas Kusalananda Kähäri, 2020/03/13