From this web page :
http://tldp.org/LDP/abs/html/abs-guide.html
It\'s mentioned the usage of the if bracket then convention which need a space after the semicol
This has become the style in the last few years:
if [ -x "$filename" ]; then
echo "hi"
fi
However, back when dinosaurs like Burroughs and Sperry Rand ruled the earth, I learned to write if statements like this:
if [ -x "$filename" ]
then
echo "hi"
fi
Then, you don't even need a semicolon.
The new style with then
on the same line as the if
started in order to emulate the way C
and other programming languages did their if
statements:
if (! strcmp("foo", "bar")) {
printf "Strings equal\n";
}
These programming languages put the opening curly brace on the same line as the if
.