Bird
0
0

What is the output of the following command?

medium📝 Command Output Q13 of 15
Bash Scripting - Text Processing in Scripts
What is the output of the following command?
grep 'world' <<< "hello world"
A"
Bworld
Chello
Dhello world
Step-by-Step Solution
Solution:
  1. Step 1: Understand grep with here string input

    The here string sends "hello world" as input to grep. Grep searches for lines containing 'world'.
  2. Step 2: Determine grep output

    The entire line "hello world" contains 'world', so grep outputs the full line.
  3. Final Answer:

    hello world -> Option D
  4. Quick Check:

    grep outputs matching lines = hello world [OK]
Quick Trick: grep prints full matching lines from input [OK]
Common Mistakes:
MISTAKES
  • Expecting only the matched word
  • Confusing grep output with cut or awk
  • Thinking here string changes grep behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes