Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Use Conditional Statements in Bash


    Knowing how conditionals work in bash open up a world of scripting possibilities. We’ll learn the basic syntax, including if, else, and elif. Then we'll look at a few of the "primary" operators you can leverage in a conditional statement such as = for string equality, -eq for numeric equality, and -e to check if a file exists. After that, we'll use conditional statements to create a function that asserts that the HTTP status of a given URL is between 200 and 299.