| commit | 3eec42cbad02d0d85b58c36374aad495806cb97e | [log] [tgz] |
|---|---|---|
| author | Charles Duffy <chaduffy@cisco.com> | Tue Sep 20 12:11:33 2016 -0500 |
| committer | Carlos Sanchez <carlos@apache.org> | Mon Sep 26 17:03:10 2016 +0200 |
| tree | 009eab53be60aed7f9286ee35ba2f610ae47ef98 | |
| parent | ffbd787bd6373d03418c0a09471cebc55b5d5301 [diff] |
Full best-practices / shellcheck-compliance pass - Use modern `$()` syntax vs backticks [see [SC2006](https://github.com/koalaman/shellcheck/wiki/SC2006)] - Always check for, and bail on, failures of `cd`. [see [SC2164](https://github.com/koalaman/shellcheck/wiki/SC2164)] - Avoid `for foo in $(...)`, per [DontReadLinesWithFor](http://mywiki.wooledge.org/DontReadLinesWithFor) - Avoid parsing `ls` to find subdirectories when `for d in "$dir"/*/` does the job; see also [ParsingLs](http://mywiki.wooledge.org/ParsingLs) - `\s` is not specified in POSIX ERE (thus, not guaranteed to be available in bash-native regexes unless local platform's C library's regex implementation extends standard); use `[[:space:]]` instead. - Avoid unnecessary deviations from POSIX sh specification: - `echo -e` violates (not just extends) POSIX, doesn't work as expected in bash compiled with `--enable-xpg-echo-default`; [POSIX specification](http://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html) suggests `printf` as replacement (see APPLICATION USAGE section). - `function` keyword not specified in POSIX, provides no benefit over standard-compliant syntax