
On Thu, Feb 20, 2014 at 09:52:23PM +0100, David Caro wrote:
Hi everyone!
Lately I've had a hard time to properly review some patches containing shell scripts to manage our infrastructure because there's no guidelines. So I created a wiki page with a proposal [1]. It's made up as a mix of some already existing guidelines.
The reason to wrote a bash style guide and not a shell stile guide is because I think that bash is widely adopted (default GNU shell) and provides enough advantages to sacrifice some portability. I think that most of our maintenance and management scripts will never be run on non-GNU OSes.
What are the advantages in your opinion? I like the $() construct and local variables. Associative arrays can come up handy.
POSIX compliance should be only used when really needed, for example, scripts to build a specific project, that might be run on non-GNU based systems in the far future.
I have the opposite sentiment - diversions from the standard should be kept small and well-justified.
This thread is to start a discussion about it so please, share your opinions and concerns (and proposals).
Could you detail where [1] is different from the http://wiki.bash-hackers.org/scripting/style that it cites? BTW, it's missing the most important rule, that can turn the shell into a programming language: the -e option. Not using it is basically equivalent to wrapping every python line within its own try-except-pass block.