1276
Comment:
|
1436
|
Deletions are marked like this. | Additions are marked like this. |
Line 7: | Line 7: |
* [[https://google.github.io/styleguide/shellguide.html|Google's shell script style guide]]. Also good is [[https://bash3boilerplate.sh/|Bash 3 Boilerplate]] |
Interesting bash aliases and functions:
https://github.com/Bash-it/bash-it: Community bash "framework"
Google's shell script style guide. Also good is Bash 3 Boilerplate
Neat features
-v for testing set variables, while handling undefined ones
-v: True if the shell variable varname is set (has been assigned a value).
bash >=4.2 supports -v for testing for *set* variables while handling empty ones, also no specials needs when running under 'set -u':
also:
If you use bash, you should really use ]] instead of [ ]. It can do everything [ can (and then some, like ERE and glob matches), but is a shell keyword, which improves ergonomics quite a bit. See [ $x = 0 ] vs. [[ $x = 0 after unset x, for example.
Tools
Use shellcheck with timonwong.shellcheck plugin.
Use bash-language-server.