bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Documentation issue


From: Chet Ramey
Subject: Re: Documentation issue
Date: Thu, 26 Oct 2017 08:56:37 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]