[prev in list] [next in list] [prev in thread] [next in thread]
List: bash-bug
Subject: Re: bug: readonly array that is empty causes error (whereas not empty does not)
From: Chet Ramey <chet.ramey () case ! edu>
Date: 2015-12-23 13:40:47
Message-ID: 567AA45F.1030200 () case ! edu
[Download RAW message or body]
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 -ue
> readonly -a ARGS=("${@}")
>
> If no arguments are passed then the script fails. It's surprising the
> error behavior diverges depending upon setting an empty array or non-empty
> array.
I can't reproduce this in any bash version going back to bash-2.05b.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic