Test command with the if command

You have seen how to use the test command or the short version [ ]. This test returns zero (true) or non-zero (false).

You will see how to check the returned result using the if command.

Get Mastering Linux Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.