These multiple choice questions address the “Finding Things” section in the Unix Shell lesson.
Which command would you use to find a string in any Python file on the file system?
- A. Command including
find, but without
- B. Command including both
- C. Command including
grep -r, but without
- D. Command including
grep -r --include, but without
Which command would you use to find text files mentioned in text files?
find . -name "*.txt" | grep .txt
grep -r .txt
grep .txt $(find . -name "*.txt")
grep -w .txt $(find . -name "*.txt")
- A. Demonstrates a misunderstanding of the way
grepinteracts with the pipe throughput. This answer greps the output of
findas if it is one file.
- B. Demonstrates a misunderstanding of the difference between searching for text in all files and the search for text in a subset of files.
- C. Correct answer.
- D. Demonstrates a misunderstanding of the way
greparguments modify the search query.