What's the standard for indentation in shell scripts?
There is no standard indentation in shell scripts that matters.
Slightly less flippant answer:
- Pick a standard in your team that you can all work to, to simplify things.
- Use something your editor makes easy so you don't have to fight to stick to the standard.
I've never encountered shell specified style guide but for bash programming this is the most popular one:
Bash Style Guide and Coding Standard.pdf | lug.fh-swf.de
The indentation of program constructions has to agree with the logic nesting depth. The indentation of one step usually is in line with the tabulator steps of the editor selected. In most cases 2, 4 or 8 are chosen.
The Google Style Guide says 2 spaces
Agree with others that it is an arbitrary choice.
Its source code is hosted at: https://github.com/google/styleguide