Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: L A Walsh Newsgroups: gnu.bash.bug Subject: Re: T/F var expansion? Date: Mon, 29 Jul 2019 00:57:55 -0700 Lines: 36 Approved: bug-bash@gnu.org Message-ID: References: <5D3E7367.8050308@tlinx.org> <20190729070111.3342a96938ec9d530679a268@schrader-schulte.de> <5D3EA703.904@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 1564387084 1799 209.51.188.17 (29 Jul 2019 07:58:04 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash To: Martin Schulte Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird In-Reply-To: <20190729070111.3342a96938ec9d530679a268@schrader-schulte.de> 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: <5D3EA703.904@tlinx.org> X-Mailman-Original-References: <5D3E7367.8050308@tlinx.org> <20190729070111.3342a96938ec9d530679a268@schrader-schulte.de> Xref: csiph.com gnu.bash.bug:15254 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