Tests
In this lesson, you'll learn some of the pitfalls and rules of thumb for practical usage of tests. You'll learn about how bash tests can be written, binary, unary, and logical operators, and if statements.
We'll cover the following
How Important is this Lesson?
Tests are a fundamental part of bash scripting, whether it’s on the command line in one-liners, or in much larger scripts or chains of commands.
What Are Bash Tests?
A test in bash is not a test that your program works. It’s a way of writing an expression that can be true or false.
Tests in bash are constructs that allow you to implement conditional expressions. They use square brackets (ie [
and ]
) to enclose what is being tested.
For example, the simplest tests might be:
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy