Serious question, why use a semicolon to put do and then on the end of the previous line?
Especially when do/done are the open and close control directives for a block.
Don't you think bash looks much cleaner when you use it how it was designed?
Serious question, why use a semicolon to put do and then on the end of the previous line?
Especially when do/done are the open and close control directives for a block.
Don't you think bash looks much cleaner when you use it how it was designed?
In defense of OP, I do this a lot and go for similar moves in other languages too if the conditional bit is just a line or two. Pro choice!
Bash doesn't ever look clean.
It's just a brace on same line/new line stylistic choice with extra steps.
About that, I used to also think that brace on new line is clearer, but after seeing a lot more code I have switched sides, both are clear enough to me, so I'd rather have fewer lines
Not OP but this is how I learned it and how it's presented in the help file.
$ help while
while: while COMMANDS; do COMMANDS-2; done
$ help if
if: if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
Thats the concise help text to keep it short and easy to read.
The first line in the GNU Bash manual section on loop constructs says "Note that wherever a ‘;’ appears in the description of a command’s syntax, it may be replaced with one or more newlines."
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0