Save this video — free

Lecture 12: Conditional statements

Burton Ma · 47:10 · Watch on YouTube

Lecture 12: Conditional statements Watch on YouTube →

Overview

Burton Ma explains Bash conditional statements by showing that an `if` condition is evaluated through a command’s exit status: zero means true, and nonzero means false. He demonstrates `[[ ... ]]` tests for variables, files, and strings; explains glob-pattern matching and redirection; and recommends `(( ... ))` for numeric comparisons and compound arithmetic conditions.

Key takeaways

Chapters

0:00 Bash `if` Syntax and Exit-Status Conditions
4:00 Using `cd` as a Condition and Quoting Directory Arguments
12:00 Sending Script Errors to Standard Error and `/dev/null`
15:30 Bash `[[ ... ]]` Tests and ShellCheck
20:00 Variable Assignment and File Tests in `[[ ... ]]`
25:00 String Tests, Glob Patterns, and Regular Expressions
30:00 Integer Comparisons and Argument-Count Validation
37:00 Combining Conditions with Negation, AND, and OR
43:20 Testing Leap Years with Arithmetic Conditions

Keep these chapters and the full searchable transcript in your own library.

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Burton Ma.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.