Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15254

Re: T/F var expansion?

From L A Walsh <bash@tlinx.org>
Newsgroups gnu.bash.bug
Subject Re: T/F var expansion?
Date 2019-07-29 00:57 -0700
Message-ID <mailman.100.1564387084.1985.bug-bash@gnu.org> (permalink)
References <5D3E7367.8050308@tlinx.org> <20190729070111.3342a96938ec9d530679a268@schrader-schulte.de> <5D3EA703.904@tlinx.org>

Show all headers | View raw



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


Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: T/F var expansion? L A Walsh <bash@tlinx.org> - 2019-07-29 00:57 -0700

csiph-web