Automation, Orchestration, and Scripting

A monitoring script must store the number of entries in /data in a variable named count so it can be compared later. Which line does this correctly in Bash?

Show the answer

Correct answerC. count=$(ls /data | wc -l)

Command substitution with $( ) runs the pipeline and replaces it with its output. Single quotes are the tempting wrong choice: they prevent any expansion, so count would hold the literal text of the command.