On 12/20/18 8:12 AM, Greg Wooledge wrote:
> The issue you're reporting appears to be present in arithmetic contexts
> in general, not only arrays:
>
> wooledg:~$ echo $((~0))
> bash: /home/wooledg: syntax error: operand expected (error token is
> "/home/wooledg")
This is what was fixed post-bash-4.4. I left the array subscript expansion
unchanged for backwards compatibility.
> It appears that bash is performing tilde expansion when there's no
> whitespace in front of the tilde, or bitwise negation if there is
> whitespace.
Because tilde expansion only happens on the first character of a string,
or following an unquoted `=' or `:'.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/