← All Exercises
Conditional Tests and File Checks
basicbash
Background
Conditional tests are the foundation of decision-making in bash scripts.
Problem
Write conditional tests for file existence, string equality, and numeric comparison using [[ ]].
Input
Test conditions
Output
Boolean test results
Sample tests
Sample 1
Input: [[ -f file.txt ]]
Expected: true if file exists
Your solution
Learning objective
Learn bash conditionals and test operators