On 10/26/17 1:18 AM, Eli Barzilay wrote:
> Bash surprised me with the behavior mentioned here:
> 
>     https://stackoverflow.com/questions/15897473
> 
> This can be pretty bad in that it's very unexpected (see the comments).

I'm not sure why this is a surprise. Pathname expansion (globbing) is one
of the word expansions performed before a simple command is executed. The
`unset' builtin is no different.


> The thing is that AFAICT, there is no mention of this pitfall in the man
> page...  

"The  unset  builtin  is  used to destroy arrays.  unset name[subscript]
destroys the array element at index subscript.  Negative subscripts  to
indexed  arrays are interpreted as described above.  Care must be taken
to avoid unwanted side effects caused  by  pathname  expansion."

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to