i didnt care about how i wrote my bash scripts, coz i know theyd ultimately be used just by myself. but for the past few day, i’ve been working on this project, mk-blog which uses some bash scripts, there are chances that others might look at them. besides in work they’re asking me maintain a server. so why not learn the standards. but i couldn’t find anything good online (i’m gonna blame my search engine lol). so…
i’d appreciate redirections to (official or community) bash coding standards
Don’t know about everyone else, but here are some of mine:
A post to save ❤️
Only thing to disagree here is 80 char limit, would go for 120 personally.
Also, IMHO, pipes should be at the beginning of the next line, not at the end of the previous one.
Makes cleaner commits and nicer diffs.
So much this!
This guy scripts
I once did a sh script that needed (because I wanted a challenge?) to be compatible with vanilla Android shell too. So I needed to test it with regular bash, busybox and mksh+toybox. That was ‘fun’.
I’ve had some initial plans to spllit the code out from that project and develop a “shell” library that would ease building shell scripts that are compatible with different systems… But I bet someone else has already done that.