Avoid replacing files unnecessarily.
Section: Files and Temporary Paths
Copy file if contents differ
bash
bash
cmp -s new.conf current.conf || cp new.conf current.confExplanation
Useful in deployment and config-management scripts.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Files and Temporary Paths
Check if command exists
Require a dependency before running script logic.
Walk up to repo root
Walk upward until a matching parent directory is found.