Bird
0
0

Which of the following commands correctly uses a here string to count the number of words in "hello world"?

easy🧠 Conceptual Q2 of 15
Bash Scripting - Text Processing in Scripts
Which of the following commands correctly uses a here string to count the number of words in "hello world"?
Awc -w < "hello world"
Bwc -w <<< "hello world"
Cwc -w << "hello world"
Dwc -w > "hello world"
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct here string syntax

    The correct syntax for here string is <<<, so wc -w <<< "hello world" is correct.
  2. Step 2: Understand other redirection operators

    << is a here document, < is input redirection from file, and > is output redirection.
  3. Final Answer:

    wc -w <<< "hello world" -> Option B
  4. Quick Check:

    Here string syntax = wc -w <<< string [OK]
Quick Trick: Use <<< for here strings, not << or < [OK]
Common Mistakes:
MISTAKES
  • Using << instead of <<< for here strings
  • Confusing input and output redirection
  • Missing quotes around the string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes