Assign command output to a variable.
Section: Variables and Expansion
Capture command output
bash
bash
files=$(find . -type f | wc -l)Explanation
Use `$(...)` instead of legacy backticks.
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 Variables and Expansion