[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test '-v' - associative vs. normal array discrepancy - a bug ?
From: |
Greg Wooledge |
Subject: |
Re: test '-v' - associative vs. normal array discrepancy - a bug ? |
Date: |
Wed, 19 Nov 2014 15:05:06 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Nov 19, 2014 at 07:59:42PM +0000, Jason Vas Dias wrote:
> [ ${#v[@] -gt 0 ] does not work
> if $v is a normal variable.
Doesn't it? It seems to work for me (once you fix the typo):
imadev:~$ unset v; v=''; test "${#v[@]}" -gt 0 && echo yes
yes
imadev:~$ unset v; v='x'; test "${#v[@]}" -gt 0 && echo yes
yes
imadev:~$ unset v; test "${#v[@]}" -gt 0 && echo yes
imadev:~$
Granted, it's an awkward expression. I'm not arguing against fixing -v.
- test '-v' - associative vs. normal array discrepancy - a bug ?, Jason Vas Dias, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Greg Wooledge, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Piotr Grzybowski, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Chet Ramey, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Piotr Grzybowski, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Jason Vas Dias, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?,
Greg Wooledge <=
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Eduardo A . Bustamante López, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Greg Wooledge, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Piotr Grzybowski, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Greg Wooledge, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Piotr Grzybowski, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Greg Wooledge, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Piotr Grzybowski, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Greg Wooledge, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Piotr Grzybowski, 2014/11/19
- Re: test '-v' - associative vs. normal array discrepancy - a bug ?, Chet Ramey, 2014/11/19