Bird
0
0

Which of the following is the correct syntax to append the output of the command date to a file named dates.log?

easy📝 Syntax Q3 of 15
Bash Scripting - File Operations in Scripts
Which of the following is the correct syntax to append the output of the command date to a file named dates.log?
Aappend date dates.log
Bdate >> dates.log
C>> date dates.log
Ddate > dates.log
Step-by-Step Solution
Solution:
  1. Step 1: Understand command output redirection

    The command date >> dates.log runs date and appends its output to the file.
  2. Step 2: Check syntax correctness

    > overwrites, > date dates.log is invalid syntax, and append is not a bash command.
  3. Final Answer:

    date >> dates.log -> Option B
  4. Quick Check:

    Append command output with >> [OK]
Quick Trick: Command >> file appends output to file [OK]
Common Mistakes:
MISTAKES
  • Using > which overwrites
  • Wrong operator order
  • Using non-existent commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes