help-bash
[Top][All Lists]
Advanced

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

Re: access exported var


From: Peng Yu
Subject: Re: access exported var
Date: Mon, 16 Jan 2023 18:12:21 -0600

On 1/16/23, Lawrence Velázquez <vq@larryv.me> wrote:
> On Mon, Jan 16, 2023, at 3:15 PM, Peng Yu wrote:
>> On 1/16/23, Leonid Isaev <leonid.isaev@ifax.com> wrote:
>>> if I know that an array "${a[@]}" can't be exported, and want to
>>> export its 1st element, I will do just that: export a variable
>>> "${a[0]}"...
>>
>> Then, you are then suggesting ${Z[0]} instead $Z for the first element
>> of the Z array, for the same logic.
>>
>> I'd rather have $Z as a shorthand notation of ${Z[0]} for the fewer
>> keystrokes. Bash is for command line interaction, every keystroke
>> counts.
>
> Not everyone agrees with your priorities and opinion on what bash
> is "for".  One could say (and I do) that brevity should not take
> unqualified precedence over clarity and explicitness.

But bash already favors brevity in many instances as a matter fact.
Whatever you think it should be in terms of brevity and
clarity/explicitness does not matter at this time. (For example,
variable may not be declared, almost any string can be a command
name.)

It is logical to only expand bash in the principles that it followed for years.

>> If you want verbosity, you can use java.

My point is that bash is for verbosity. Something as verbose as
mandating ${x[0]} should not even be bothered to be raised.

> This suggestion is unhelpful.  "Verbosity" aside, Java and bash are
> tailored for different use cases.
>
> --
> vq
>


-- 
Regards,
Peng



reply via email to

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