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 14:15:42 -0600

On 1/16/23, Leonid Isaev <leonid.isaev@ifax.com> wrote:
> On Mon, Jan 16, 2023 at 12:07:25PM -0600, Peng Yu wrote:
>> Given arrays cannot be exported, is it better to export nothing or
>> export the first element?
>
> You asked a very philosophical (not in a good sense) question: 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. If you want verbosity, you can use java. It is notorious in
this aspect so that people literally have to use an IDE to deal with
the bloated code in java.

> So, I vote for nothing.
>
> --
> Leonid Isaev
>
>


-- 
Regards,
Peng



reply via email to

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