Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Robert Elz Newsgroups: gnu.bash.bug Subject: Re: Are there any plans for more readable, modern syntaxes for If statements? Date: Fri, 13 Mar 2020 21:52:59 +0700 Lines: 35 Approved: bug-bash@gnu.org Message-ID: References: <4305.1584111179@jinx.noi.kre.to> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1584111229 18693 209.51.188.17 (13 Mar 2020 14:53:49 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Eli Schwartz , bug-bash@gnu.org To: John McKown Envelope-to: bug-bash@gnu.org In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2001:3c8:9009:181::2 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: <4305.1584111179@jinx.noi.kre.to> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16029 Date: Fri, 13 Mar 2020 06:59:56 -0500 From: John McKown Message-ID: | I do things like: | | test && { true_command1;true_command2; : ; } || { | false_command1; false_command2; false_command3; } That's OK, and at times I have been tempted that way, but it really is easier to just do if then true_command1 true_command2 else false_command1 false_command2 false_command3 fi Not only do you not need to remember that the ':' command (or "true") is important, but the exit status of all of this will be whichever of true_command2 or false_command3 that was executed, which can be used in other tests later. The cost of typing a few extra words to make things clearer, and having the code not look quite so "look what I can do ma" (ie: less "cool") is worth it to be more clear, and less likely to have bugs. kre