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'.