Automation, Orchestration, and Scripting

A directory contains log files with spaces in their names, such as "app server.log". Which loop compresses each .log file as a separate item without splitting the names?

Show the answer

Correct answerB. for f in *.log; do gzip "$f"; done

A glob in the for list expands to one word per file, and quoting "$f" preserves spaces. Command substitution such as $(find ...) is word-split on whitespace, so "app server.log" would still break into two items even with the quotes.