help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Awkward behavior of empty arrays


From: Greg Wooledge
Subject: Re: [Help-bash] Awkward behavior of empty arrays
Date: Thu, 7 Sep 2017 08:31:58 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Thu, Sep 07, 2017 at 02:23:50PM +0200, Cristian Zoicas wrote:
> Greg Wooledge wrote:
> > wooledg:~$ set -u
> > wooledg:~$ unset a
> > wooledg:~$ for i in "address@hidden"; do :; done
> > wooledg:~$ a=()
> > wooledg:~$ for i in "address@hidden"; do :; done
> > wooledg:~$ a="a string"
> > wooledg:~$ for i in "address@hidden"; do :; done
> > wooledg:~$ unset a
> > wooledg:~$ a=([1]=foo)
> > wooledg:~$ for i in "address@hidden"; do :; done
> > wooledg:~$ echo "${a[0]}"
> > bash: a[0]: unbound variable
> > wooledg:~$ set +u

> Could you please provide information about your bash version ?
> 
> Mine is
> 
> GNU bash, version 4.3.30(1)-release (i586-pc-linux-gnu)
> Copyright (C) 2013 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> 
> Running on Debian GNU/Linux 8.1 (jessie)

4.4.12(1)-release
As packaged by Debian 9 (stretch), amd64.

ii  bash           4.4-5        amd64        GNU Bourne Again SHell



reply via email to

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