What it does: Makes decisions in your script—like branching if files exist or numbers match—so your automation can react to real conditions.
What is it? Conditional logic lets your script take different paths depending on a test—like file exists, command success, or number comparisons.
#!/bin/bash
FILE="example.txt"
if [[ -f "$FILE" ]]; then
echo "Found $FILE"
else
echo "Creating $FILE"
echo "Hello" > "$FILE"
fi