News for hackers. Stuff that matters.
Re:Elegant Bash Conditionals by pizza234 on Tuesday March 02, 2021 @02:18PM (#26319192)
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 :)
Re:Elegant Bash Conditionals by a1369209993 on Tuesday March 02, 2021 @05:16PM (#26321781)
I 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.
Re:Elegant Bash Conditionals by joana035 on Tuesday March 02, 2021 @07:24PM (#26323156)
How swapping a '\n' char for a ';' is less "wasteful" or "ugly"?