Re: bug: readonly array that is empty causes error (whereas not empty does not)

2016-01-07 Thread Chet Ramey
On 1/7/16 1:54 AM, James Thomas Moon wrote: > I attempted to reproduce the error. The closest error I could reproduce is > slightly different than my original email suggests. > The problem I reproduced below is an undefined variable. To the best of my > recollection, the original error was silent

Re: bug: readonly array that is empty causes error (whereas not empty does not)

2015-12-23 Thread Chet Ramey
On 12/23/15 1:49 AM, James Thomas Moon wrote: > The following script is okay > > set -ue > readonly -a a=('') > > Yet, the following script fails with exit code 1 > > set -ue > readonly -a a=() > > In my case, I would like to preserve a copy of all passed arguments: > > set

Re: bug: readonly array that is empty causes error (whereas not empty does not)

2015-12-23 Thread Piotr Grzybowski
On Wed, Dec 23, 2015 at 12:29 PM, konsolebox wrote: > On Wed, Dec 23, 2015 at 2:49 PM, James Thomas Moon wrote: >> In my case, I would like to preserve a copy of all passed arguments: [..] > I can't reproduce this. My script always returns 0. same here. cant reproduce on any version. pg

Re: bug: readonly array that is empty causes error (whereas not empty does not)

2015-12-23 Thread konsolebox
On Wed, Dec 23, 2015 at 2:49 PM, James Thomas Moon wrote: > In my case, I would like to preserve a copy of all passed arguments: > > set -ue > readonly -a ARGS=("${@}") > > If no arguments are passed then the script fails. It's surprising the error > behavior diverges depending upon setti