help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Extend the syntax to allow `declare x -a y`?


From: Peng Yu
Subject: [Help-bash] Extend the syntax to allow `declare x -a y`?
Date: Mon, 26 Aug 2019 19:56:01 -0500

`declare` does not allow both a scalar and an array.

$ declare x -a y
-bash: declare: `-a': not a valid identifier
$ declare x
$ declare -a y


But there seems to be no reason that this extension can not be done
and would cause ambiguities. The advantage of adding these features is
that variables can be declared by one statement. Can this feature be
added?

Also, something like this should be considered when designing syntax
to allow the declaration of both scalars and arrays. It is better to
maintain the order of the variables in the contracted form of
`declare`.

$ declare x
$ declare -a y
$ declare z

-- 
Regards,
Peng



reply via email to

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