[scripts] Discussion about shell scripts indentation policy
As of commit 943e17b5 there was a massive change of shell script files indentation with 4-spaces instead of tabs and 2-spaces previously used in different scripts.
I haven't found any widely used standard or styling guide. However in my practice I tend to use tabs due to presence of <<-
construct which lets to embed arbitrary text data into the script with tabs-based (but not spaces) indentation automatically removed. As a result usage of tabs lets to keep file indentation consistent and to fit arbitrary heredocs nicely across the sources:
cat > ./file1 <<- EOF
Content of the file
with a lot of lines
automatically generated
EOF
if condition; then
cat > ./file2 <<- EOF
Condition met
EOF
else
for i in $(seq 10); do
cat >> ./file3 <<- EOF
Condition not met ${i} time(s)
EOF
done
fi
Usage of spaces for non-heredoc parts of script would lead to inconsistent indentation levels in the example above and would require additional attention and focus on handling of whitespace usage.
As to me I don't know any other constructs of shell scripts to be tabs/space indentation sensitive.