Bird
0
0

What is the main purpose of using a here document (<<EOF) in a bash script?

easy🧠 Conceptual Q11 of 15
Bash Scripting - Text Processing in Scripts
What is the main purpose of using a here document (<
ATo provide multiple lines of input or text to a command easily
BTo create a new file automatically
CTo run commands in the background
DTo define a function in the script
Step-by-Step Solution
Solution:
  1. Step 1: Understand the here document concept

    A here document lets you send multiple lines of text or commands as input to a command in a script.
  2. Step 2: Identify the correct purpose

    It is not for creating files, running background commands, or defining functions, but for providing multiline input.
  3. Final Answer:

    To provide multiple lines of input or text to a command easily -> Option A
  4. Quick Check:

    Here document = multiline input [OK]
Quick Trick: Here documents send blocks of text to commands [OK]
Common Mistakes:
MISTAKES
  • Thinking it creates files automatically
  • Confusing with background job control
  • Assuming it defines functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes