[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: T/F var expansion?
From: |
L A Walsh |
Subject: |
Re: T/F var expansion? |
Date: |
Mon, 29 Jul 2019 00:57:55 -0700 |
User-agent: |
Thunderbird |
On 2019/07/28 22:01, Martin Schulte wrote:
> Hello!
>
>> Is there a T/F var expansion that does:
>> var=${tst:+$yes}${tst:-$no}
>> but with yes/no in 1 expansion?
>>
>
> At least if you are only working with numbers you can use
> ((var=(tst!=0?42:31)))
> But is this a question for bug-bash?
> Best regards,
> Martin
>
----
I'm familiar with the numeric form, and many times have lamented the
lack of a similar form for non-numeric data.
The fact that bash provides such a feature for numbers but not
for strings, seems like a missing feature. Depending on whether or
not you expected or wanted a language to provide similar operators for
the various types of data it can process such a deficit might be felt
to be a sufficient problem to warrant a solution. Wouldn't it be
the case that the lack of such a feature became a "type" of bug
that required, to the extent it was wanted, a "fix"?
That said, I'm pretty sure that ideas for bash don't have to be
existing bugs in order to be considered something that might qualify
for a code addition or update.
-l