bug-bash
[Top][All Lists]
Advanced

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

Re: nullglob make unset on array member fail ?


From: Greg Wooledge
Subject: Re: nullglob make unset on array member fail ?
Date: Mon, 23 Jan 2017 10:00:45 -0500
User-agent: Mutt/1.4.2.3i

On Mon, Jan 23, 2017 at 03:04:40PM +0100, admn ombres wrote:
> $ x=(x); echo ${#x[@]}; shopt -s nullglob; unset x[0]; echo ${#x[@]}

You need to quote 'x[0]' to avoid having it globbed against files in
the current working directory, regardless of whether you're using
nullglob.

The presence of a file named x0 in $PWD would change the meaning of your
unset command from unset 'x[0]' to unset 'x0'.



reply via email to

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