Prevent Unset Variables in Your Shell / Bash Scripts with set -o nounset

Опубликовано: 30 Сентябрь 2024
на канале: Nick Janetakis
694
37

This is really handy to help protect against variable typos and it's POSIX compliant.

Hit the subscribe button to receive more videos like this!

REFERENCE LINKS
---------------------------------------------------
► https://nickjanetakis.com/blog/allowi...
► https://www.gnu.org/software/bash/man...

COURSES
---------------------------------------------------
Courses I've created that focus on web dev and deployment topics.

► https://nickjanetakis.com/courses/

THE TOOLS I USE / GEAR
---------------------------------------------------
► https://nickjanetakis.com/blog/the-to...

FOLLOW ME ELSEWHERE
---------------------------------------------------
► Twitter:   / nickjanetakis  
► GitHub: https://github.com/nickjj

TIMESTAMPS
---------------------------------------------------
0:00 -- Intro
0:32 -- ShellCheck can help us here but we can do better
0:43 -- Protecting ourselves from variable typos with the nounset option
1:52 -- Handling optional variables by setting an "empty" default
3:43 -- Defining all of your variables is a good practice to adhere to