help-bash
[Top][All Lists]
Advanced

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

Re: bash 'if [[ <cond> ]]; then ...fi' should 'then' be redundant?


From: Greg Wooledge
Subject: Re: bash 'if [[ <cond> ]]; then ...fi' should 'then' be redundant?
Date: Thu, 7 May 2020 11:32:35 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, May 07, 2020 at 01:59:39PM +0000, Vang Le-Quy wrote:
> So it is like this
> 
> If do-command-list-and-if-the-last-command-returns-true
> then
>       DO-WHATEVER1
> elif1 
> in-case-THE-IF-returns-false-and-do-command-list-and-if-the-last-command-returns-true
[...]

No.  You're not getting it.  You can put multiple commands between "if"
and "then".


if   command 1
     command 2
     command 3
then
     stuff 1
     stuff 2
fi



That's why "then" is required.  Otherwise you don't know when the first
command list is finished.



reply via email to

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