bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: James Thomas Moon
Subject: bug: readonly array that is empty causes error (whereas not empty does not)
Date: Tue, 22 Dec 2015 22:49:48 -0800

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.

-James Thomas Moon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]