bug-bash
[Top][All Lists]
Advanced

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

Re: Are there any plans for more readable, modern syntaxes for If statem


From: L A Walsh
Subject: Re: Are there any plans for more readable, modern syntaxes for If statements?
Date: Thu, 19 Mar 2020 17:41:59 -0700
User-agent: Thunderbird

On 2020/03/13 07:52, Robert Elz wrote:
That's OK, and at times I have been tempted that way, but it really is
easier to just do

        if <some relational test>
        then
                true_command1
                true_command2
        else
                false_command1
                false_command2
                false_command3
        fi
----
If you need an else clause, then using 'if' makes sense,
but for a simple 1-liner equivalent to C's

 if (bool) truecase;

bash's

 $bool && truecase

is certainly shorter than any if;then;fi case and for a simple 1-liner,
just as clear if not more so.

Being concise was certainly not a design priority as much for shell
as for C.




reply via email to

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