nerdexam
Linux_Foundation

LFCS · Question #243

Which of the following bash option will prevent an administrator from overwriting a file with a ">"?

The correct answer is C. set -o noclobber. The set -o noclobber bash option prevents accidental overwriting of existing files using output redirection operators like > or >&.

Submitted by manish99· Apr 18, 2026Essential Commands

Question

Which of the following bash option will prevent an administrator from overwriting a file with a ">"?

Options

  • Aset -o safe
  • Bset -o noglob
  • Cset -o noclobber
  • Dset -o append
  • Eset -o nooverwrite

How the community answered

(31 responses)
  • B
    3% (1)
  • C
    94% (29)
  • E
    3% (1)

Why each option

The `set -o noclobber` bash option prevents accidental overwriting of existing files using output redirection operators like `>` or `>&`.

Aset -o safe

`safe` is not a standard bash option for preventing file overwriting.

Bset -o noglob

`set -o noglob` disables pathname expansion (globbing), which is unrelated to file overwriting prevention.

Cset -o noclobberCorrect

The `set -o noclobber` command enables the `noclobber` shell option, which prevents the shell from overwriting an existing file using redirection operators like `>` or `>|` unless explicitly forced with `>|`. This protects against accidental data loss.

Dset -o append

`append` is not a bash option for `set -o`; `>>` is an operator for appending to a file, but `set -o append` doesn't exist as a shell option.

Eset -o nooverwrite

`nooverwrite` is not a standard bash option for preventing file overwriting.

Concept tested: Bash shell options for file redirection safety

Source: https://linux.die.net/man/1/bash

Topics

#bash#shell options#file redirection#noclobber

Community Discussion

No community discussion yet for this question.

Full LFCS Practice