| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
| tech:bash_bonnes_pratiques [2025/05/19 15:29] – Jean-Baptiste | tech:bash_bonnes_pratiques [2025/05/27 09:39] (Version actuelle) – Jean-Baptiste |
|---|
| Voir : | Voir : |
| * https://google.github.io/styleguide/shellguide.html | * https://google.github.io/styleguide/shellguide.html |
| | * https://github.com/google/styleguide/blob/gh-pages/shellguide.md |
| * http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming | * http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming |
| * http://www.linuxjournal.com/content/working-functions-towers-hanoi | * http://www.linuxjournal.com/content/working-functions-towers-hanoi |
| * https://github.com/icy/bash-coding-style | * https://github.com/icy/bash-coding-style |
| | * http://redsymbol.net/articles/unofficial-bash-strict-mode/ |
| | * http://mywiki.wooledge.org/BashFAQ/105 |
| | * https://blog.yossarian.net/2020/01/23/Anybody-can-write-good-bash-with-a-little-effort |
| | * https://github.com/icy/bash-coding-style?tab=readme-ov-file#deprecation |
| | * https://www.reddit.com/r/linuxadmin/comments/9x1ist/what_are_your_conventions_with_bashshell_scripts/ |
| | * https://www.linkedin.com/pulse/bash-scripting-conventions-engin-polat |
| | * https://gist.github.com/the-glima/39905476c82a8acf9c81b7cfe08e5f03 |
| | * https://github.com/chenkaie/junkcode/blob/master/bash/Defensive-BASH-Programming.sh |
| | * https://bertvv.github.io/cheat-sheets/Bash.html |
| | * https://medium.com/better-programming/defensive-programming-to-create-a-robust-ish-shell-script-d9f21292d08a |
| | * https://frippertronics.com/posts/defensive_bash_programming.html |
| | * https://blog.seboss666.info/2020/04/programmation-defensive-en-bash/ |
| | * https://devhints.io/bash |
| | * https://kvz.io/blog/bash-best-practices.html & https://github.com/kvz/bash3boilerplate/ |
| | * http://unix.stackexchange.com/questions/8759/best-practice-to-use-in-bash |
| | |
| |
| |
| Voir | Voir |
| | |
| http://kvz.io/blog/2013/11/21/bash-best-practices/ | |
| |
| http://unix.stackexchange.com/questions/8759/best-practice-to-use-in-bash | |
| |
| == Les "pipes" | == Les tubes nommés (pipes) |
| |
| Source : https://blog.g3rt.nl/retain-exit-status-code-through-pipe.html | Source : https://blog.g3rt.nl/retain-exit-status-code-through-pipe.html |
| |
| |
| | == Conventions de nommage |
| | |
| | |
| | |
| | Environment variables or shell variables introduced by the operating system, shell startup scripts, or the shell itself, etc., are usually all in CAPITALS1. |
| | |
| | To prevent your variables from conflicting with these variables, it is a good practice to use lower_case variable names. |
| |
| |