Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #12100
| Path | csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| 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 | Wed, 23 Dec 2015 19:29:37 +0800 |
| Lines | 19 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.437.1450870182.843.bug-bash@gnu.org> (permalink) |
| References | <CADu5JT++xXwXF6vv-fajBPYLH6hWevx3_yNqwaY56LfV85iCYg@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | usenet.stanford.edu 1450870183 18705 208.118.235.17 (23 Dec 2015 11:29:43 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash <bug-bash@gnu.org> |
| To | James Thomas Moon <jtm.moon@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9YbD1xmN7gsiLTpursDDH355FrLb7jFE4MDvJZCgoS0=; b=h9eiuqbCcBzjwutCgrx8fHdoiRenCjgDX5B2fJiIdPnwPpX9/W+P2ratzCa4P4jQrG c//rceuuGVy4V3JsZR98uFwu4oYAqg9H8S7VZJPCAZ3bXuJsof38FKudFoZzu14EMiMd g7YKIYTQ2xP1+f3TeYXKuCNMfr37iK+0bG6KJUcwCKCbUvb8yrxhuN0H2qgjpFIeczEu BQeq6kpattNsxE1ofTfHUhQc3lvUF1pzEXa1BTOSAmk+JhO3rTJgvVQ9iU6m8y+w7R+3 tZF9bNX/aCGUWy1ndLTKun8rhibIcQDn4KDkETfdoN81QHN9IPtIzUKRP0jgKSHvdbCR tJ8Q== |
| X-Received | by 10.194.80.200 with SMTP id t8mr25217607wjx.74.1450870177900; Wed, 23 Dec 2015 03:29:37 -0800 (PST) |
| In-Reply-To | <CADu5JT++xXwXF6vv-fajBPYLH6hWevx3_yNqwaY56LfV85iCYg@mail.gmail.com> |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] |
| X-Received-From | 2a00:1450:400c:c09::233 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:12100 |
Show key headers only | View raw
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