[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nullglob make unset on array member fail ?
From: |
Chet Ramey |
Subject: |
Re: nullglob make unset on array member fail ? |
Date: |
Mon, 23 Jan 2017 10:05:30 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 1/23/17 9:04 AM, admn ombres wrote:
> $ x=(x); echo ${#x[@]}; shopt -s nullglob; unset x[0]; echo ${#x[@]}
> 1
> 1
> $ x=(x); echo ${#x[@]}; shopt -u nullglob; unset x[0]; echo ${#x[@]}
> 1
> 0
`unset' is a builtin; its arguments are subject to all the shell word
expansions, including globbing. If you don't want to take a chance on
the effects of globbing modifying the word, quote it.
--
``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/