Bird
0
0

Which of the following is the correct syntax to append the text Done to a file log.txt using echo?

easy📝 Syntax Q3 of 15
Bash Scripting - File Operations in Scripts
Which of the following is the correct syntax to append the text Done to a file log.txt using echo?
Aecho "Done" > log.txt
Becho Done << log.txt
Cecho "Done" >> log.txt
Decho Done > log.txt
Step-by-Step Solution
Solution:
  1. Step 1: Identify append operator

    The double greater-than symbol (>>) appends text to a file.
  2. Step 2: Confirm echo syntax

    Both quoted and unquoted text work, but quotes are safer for spaces or special chars.
  3. Final Answer:

    echo "Done" >> log.txt -> Option C
  4. Quick Check:

    Append text = echo with >> [OK]
Quick Trick: Use >> with echo to append text [OK]
Common Mistakes:
MISTAKES
  • Using > instead of >>
  • Omitting quotes causing errors with spaces
  • Confusing append and overwrite

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes