google shell style guide | Style guides for Google-originated open-source projects
- 1 Background
- 2 Shell Files and Interpreter Invocation
- 2.1 File Extensions
- 2.2 SUID/SGID
- 3 Environment
- 3.1 STDOUT vs STDERR
- 4 Comments
- 4.1 File Header
- 4.2 Function Comments
- 4.3 Implementation Comments
- 4.4 TODO Comments
- 5 Formatting
- 5.1 Indentation
- 5.2 Line Length and Long Strings
- 5.3 Pipelines
- 5.4 Loops
- 5.5 Case statement
- 5.6 Variable expansion
- 5.7 Quoting
- 6 Features and Bugs
- 6.1 ShellCheck
- 6.2 Command Substitution
- 6.3 Test,
[ … ]
, and\[\[ … \]\]
- 6.4 Testing Strings
- 6.5 Wildcard Expansion of Filenames
- 6.6 Eval
- 6.7 Arrays
- 6.8 Pipes to While
- 6.9 Arithmetic
- 7 Naming Conventions
- 8 Calling Commands
- 9 Conclusion
本文为摘录(或转载),侵删,原文为: https://google.github.io/styleguide/shellguide.html