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 16:48:04 -0500
User-agent:
Mutt/1.4.2.3i
On Wed, Nov 19, 2014 at 10:32:52PM +0100, Piotr Grzybowski wrote:
> I do understand your point. Dont you understand the need to check in
> a simple (I know, nothing works, nothing is simple ;-)) way that given
> variable has value? no matter what it is?
No, I don't.
If I'm writing in C, and I want to know whether one of my variables is
"empty", I have to know what type of variable it is. The code to check
whether a string (char x[10]) is "empty" is very different from the code
to check whether an array of integers (int x[10]) is "empty". Hell,
the meaning of "empty" would have to be defined by the application.
Would it mean every element is 0? Or something else? And what if x is
a float, or a double? Or a pointer? Or a struct?
The same thing happens in bash. It's simply not the kind of language
where you have one syntax that works for multiple situations.