bug-bash
[Top][All Lists]
Advanced

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

T/F var expansion?


From: L A Walsh
Subject: T/F var expansion?
Date: Sun, 28 Jul 2019 21:17:43 -0700
User-agent: Thunderbird

Is there a T/F var expansion that does:
 
    var=${tst:+$yes}${tst:-$no}

but with yes/no in 1 expansion?

Something like:

    var=${tst:^yes^no}
              |   |
              \___\___ or some other char(s)

    with the opposite syntax being allowed as

    var=${!tst:^no^yes}

(or) if '!' before the varname is unwieldy:

     var=${tst:!no!yes}

----
Obviously the 1 code-snippet solves the problem, but looks
a bit redundant, at the least...

Sorry if this is already implemented in some form, I'm just
not remembering there being one.







reply via email to

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