Shell Style Guide
google.github.io
Shell Style Guide
1–10 of 336 posts
Re: Shell Style Guide
#2Oh you mean we weren’t supposed to write an etl solution in bash?
Re: Shell Style Guide
#3Whelp, wrong right off the bat.
I'm gonna get down my my knees here and beg everyone reading: use POSIX shell. Do not write scripts with bash. Do not write scripts with zsh. Do not write scripts with fish. Use POSIX shell.
sh has a really bad interactive mode (so does bash), so I'm not gonna give anyone a hard time for using another shell as their day-to-day interactive shell. But, for the love of god, write your scripts with POSIX sh.
Re: Shell Style Guide
#4> Shell should only be used for small utilities or simple wrapper scripts. Oh you mean we weren’t supposed to write an etl solution in bash?
Re: Shell Style Guide
#5One thing I'm curious about is whether Google machines have followed Debian etc. in making /bin/sh a faster non-bash shell, or if /bin/sh is bash.
Re: Shell Style Guide
#6Re: Shell Style Guide
#7I've never seen this guide before today but skimming through I absolutely love it. It aligns with my exact bash scripting style. Everything from the variable and function naming rules, stderr logging, pipeline indentation, and even having a "main () { ...}" wrapper and invocation. It's almost creepy!
Re: Shell Style Guide
#8Re: Shell Style Guide
#9> Shell should only be used for small utilities or simple wrapper scripts. Oh you mean we weren’t supposed to write an etl solution in bash?
And in the other 10% a simple typo can cost your company millions of dollars.
Re: Shell Style Guide
#10>Bash is the only shell scripting language permitted for executables. Whelp, wrong right off the bat. I'm gonna get down my my knees here and beg everyone reading: use POSIX shell. Do not write scripts with bash. Do not write scripts with zsh. Do not write scripts with fish. Use POSIX shell. sh has a really bad interactive mode (so does bash), so I'm not gonna give anyone a hard time for using another shell as their…
What about POSIX shell makes it superior for scripting?