Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #12100
| From | konsolebox <konsolebox@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: bug: readonly array that is empty causes error (whereas not empty does not) |
| Date | 2015-12-23 19:29 +0800 |
| Message-ID | <mailman.437.1450870182.843.bug-bash@gnu.org> (permalink) |
| References | <CADu5JT++xXwXF6vv-fajBPYLH6hWevx3_yNqwaY56LfV85iCYg@mail.gmail.com> |
On Wed, Dec 23, 2015 at 2:49 PM, James Thomas Moon <jtm.moon@gmail.com> 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 setting an empty array or non-empty array.
I can't reproduce this. My script always returns 0. What version of
Bash are you using? Or perhaps can you post your actual script? The
cause of it might be somewhere.
#!/bin/bash
set -ue
readonly -a ARGS=("$@")
echo "$?"
Back to gnu.bash.bug | Previous | Next | Find similar
Re: bug: readonly array that is empty causes error (whereas not empty does not) konsolebox <konsolebox@gmail.com> - 2015-12-23 19:29 +0800
csiph-web