Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: L A Walsh Newsgroups: gnu.bash.bug Subject: T/F var expansion? Date: Sun, 28 Jul 2019 21:17:43 -0700 Lines: 31 Approved: bug-bash@gnu.org Message-ID: References: <5D3E7367.8050308@tlinx.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1564373873 27248 209.51.188.17 (29 Jul 2019 04:17:53 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <5D3E7367.8050308@tlinx.org> Xref: csiph.com gnu.bash.bug:15250 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.