Главная
Study mode:
on
1
S OPIN SOURCE SUMMIT Writing Robust Bash Scripts
2
What can go wrong here?
3
Choose a shebang (#!) carefully ...
4
If you are coding in bash then use the bash shebang
5
If you want to create a POSIX script use 'checkbashisms' script to check your script for bashisms
6
Use set -o pipefail
7
Use local for variables in functions Variables in bash have global scope
8
Cron Jobs: "SILENCE IS GOLDEN" What can go wrong with the following code if the script triggers errors that are not redirected properly?
9
Exit your scripts with an explicit exit (n 0) on any non-normal exit
10
Use www.shellcheck.net Shell Script analysis tool
Description:
Learn to create reliable and efficient Bash scripts in this 21-minute conference talk by Leonardo Gutierrez Ramirez from AutoZone. Explore common pitfalls and best practices, including choosing the appropriate shebang, using 'checkbashisms' for POSIX compliance, implementing set -o pipefail, and utilizing local variables in functions. Discover the importance of proper error handling in cron jobs, explicit exit codes, and leveraging tools like www.shellcheck.net for script analysis. Enhance your scripting skills to write more robust and maintainable Bash scripts for various applications.

Writing Robust Bash Scripts

Linux Foundation
Add to list
0:00 / 0:00