3 ms·
The traditional format of Bash's if/then has `if` and `then` on separate lines: if command_or_condition then branch fi I suppose that to man
by pizza234 6y ago
The traditional format of Bash's if/then has `if` and `then` on separate lines:
if command_or_condition
then
branch
fi
I suppose that to many, this looks wasteful and consequently ugly, so one looks for alternatives.
I always inline the `then`, which requires a semicolon:
if command_or_condition; then
branch
fi
If I was forced to use the traditional format, I'd be definitely annoyed :)
- a1369209993 6y agoI use: if command_or_condition then branch more_branch fi Given the relationship between ; and newline, and the positions of required ;s in if/then/fi, I assumed that was intended.
- joana035 6y agoHow swapping a '\n' char for a ';' is less "wasteful" or "ugly"?