Multiple choice technology programming languages

"Which of these commands redirects the output of cat testfile to redirfile without overwriting the contents of redirfile? "

  1. cat testfile >redirfile

  2. cat testfile >>redirfile

  3. cat testfile 1> redirfile

  4. cat testfile 2> redirfile

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The >> operator redirects output and appends to the file without overwriting existing contents. The > operator would overwrite the file entirely. Options C and D redirect specific file descriptors (stdout and stderr respectively), but both overwrite rather than append.