[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash 'if [[ <cond> ]]; then ...fi' should 'then' be redundant?
From: |
Vang Le-Quy |
Subject: |
bash 'if [[ <cond> ]]; then ...fi' should 'then' be redundant? |
Date: |
Thu, 7 May 2020 12:05:41 +0000 |
Ever since I wrote my first bash `if`, I was told to immediately use `then`.
This structure become so familiar:
```
if [[ <condition> ]]; then
statements
else
statements
fi
```
There might be a historical reason for `then` to be in there. But would it just
be straight forward without `then`? What is ambiguous about it?
```
if [[ <condition> ]]
statements
else
statements
fi
```
Kind regards
Vang
- bash 'if [[ <cond> ]]; then ...fi' should 'then' be redundant?,
Vang Le-Quy <=