From what I understand you can do C-style for and while loops in bash.
LIMIT=10
for ((a=1; a <= LIMIT ; a++)) # Double parentheses, and "LIMIT" with no "$".
do
echo -n "$a "
done # A construct borrowed from 'ksh93'.
And even ternary operators.
(( var0 = var1<98?9:21 ))
How would you do this with the if
statement?
Also why don't they implement braces like in C? What is the logic with using all of these keywords like done
, do
, if
, and fi
? I will be writing some scripts but bash appears very different.
Are there any bash styling techniques or bash alternatives/plugins? I would like to follow the standard, but coming from a C, Java and PHP background bash looks really weird. Maintainability and standards are important.