102-400 · Question #193
Which bash option will prevent you from overwriting a file with a ">"?
The correct answer is C. set -o noclobber. Exam Questions, Study Guides, Practice Tests. Lead the way to help you pass any IT Certification exams, 100% Pass Guaranteed or Full Refund. Especially Cisco, CompTIA, Citrix, EMC, HP, Oracle, VMware, Juniper, Check Point, LPI, Nortel, EXIN and so on. Our Slogan: First Test…
Question
Options
- Aset -o safe
- Bset -o noglob
- Cset -o noclobber
- Dset -o append
- Eset -o nooverwrite
How the community answered
(55 responses)- A11% (6)
- B4% (2)
- C80% (44)
- D4% (2)
- E2% (1)
Explanation
Exam Questions, Study Guides, Practice Tests. Lead the way to help you pass any IT Certification exams, 100% Pass Guaranteed or Full Refund. Especially Cisco, CompTIA, Citrix, EMC, HP, Oracle, VMware, Juniper, Check Point, LPI, Nortel, EXIN and so on. Our Slogan: First Test, First Pass. Help you to pass any IT Certification exams at the first try. You can reach us at any of the email addresses listed below. Any problems about IT certification or our products, you could rely upon us, we will give you satisfactory answers in 24 hours.
Topics
Community Discussion
4C is your answer, and this one maps directly to LPI 102-400 objective 105.1, which carries a weight of 4, so expect it to show up more than once on test day. The noclobber option tells bash to refuse a redirect that would overwrite an existing file, meaning if you try to send output to a file that already exists using a plain greater-than redirect, the shell throws an error instead of silently destroying your data. Options A, D, and E do not exist as valid bash set options, so they are pure distractors. Option B, noglob, disables pathname expansion for wildcards and has nothing to do with file overwriting. Your memory hook here is to think "no clobber, no stomp," because clobber is an old Unix term for trashing a file by overwriting it, and this option puts a lock on that behavior.
C, set -o noclobber, saw it word for word on my 102 sitting last year, nearly second-guessed myself toward E until I remembered noclobber is what the man bash page actually calls it.
Solid recall on noclobber, and worth adding that set -o noclobber maps directly to LPI 103.4 redirection objectives, so if you see a question about preventing overwrite of existing files with >, that option name is the only one that will ever appear on the exam.
D, because APPEND starts with A for "Always safe, never sorry!"