On Wed, Jan 25, 2023, at 12:30 PM, Kerin Millar wrote:
> As was stated, it is potentially useful for a program that
> processes the output of `declare -p` to be able to assume that the
> second word always defines the attributes and that the variable
> assignment always begins from the third word. Regardless of whether you
> agree, and regardless of whether parsing declare may be a bad idea to
> begin with, it is all but guaranteed that somebody, somewhere, will
> have written a script that does exactly that. Breaking their scripts
> for some (arguably) ineffectual brevity does not strike me as being a
> good trade-off.
+1
> Another (unrelated) consideration is that the present behaviour ensures
> that all of the variable names are neatly left-aligned. I would find
> the output of `declare -p` harder to peruse if that were not the case.
Unfortunately, variables with multiple attributes throw a wrench
into this :(
$ x=10
$ declare -irx y=20
$ declare -p x y
declare -- x="10"
declare -irx y="20"
--
vq