On 4.3 and earlier, at least on arrays, one could have
the illusion of this working w/o complaint -- and returning
0 when the array was 0-len or unset, or the array length,
otherwise:


 echo ${#array[@]:-0}

But I note it only seemed to work in arrays, and in 4.4 gets a
syntax error:

echo ${#array[@]:-0} bash: ${#array[@]:-0}: bad substitution

Is there any reason why such a syntax wouldn't be workable --
including adding:

echo ${#wordlen:-0}  to allow catching an undefined word?

or is there some other, inline way to do this?

-linda






Reply via email to