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


Groups > gnu.bash.bug > #15254 > unrolled thread

Re: T/F var expansion?

Started byL A Walsh <bash@tlinx.org>
First post2019-07-29 00:57 -0700
Last post2019-07-29 00:57 -0700
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#15254 — Re: T/F var expansion?

FromL A Walsh <bash@tlinx.org>
Date2019-07-29 00:57 -0700
SubjectRe: T/F var expansion?
Message-ID<mailman.100.1564387084.1985.bug-bash@gnu.org>

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


[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web