[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug: readonly array that is empty causes error (whereas not empty do
From: |
konsolebox |
Subject: |
Re: bug: readonly array that is empty causes error (whereas not empty does not) |
Date: |
Wed, 23 Dec 2015 19:29:37 +0800 |
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 "$?"