Bird
0
0

What is the output of the following command?

medium📝 Command Output Q4 of 15
Bash Scripting - Text Processing in Scripts
What is the output of the following command?
grep 'test' <<< "this is a test line"
Athis is a test line
Btest
CNo output
DError: command not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand grep with here string

    The here string sends "this is a test line" as input to grep, which searches for 'test'.
  2. Step 2: Determine grep output

    Since 'test' is found in the input line, grep outputs the entire matching line.
  3. Final Answer:

    this is a test line -> Option A
  4. Quick Check:

    grep output with here string = matching line [OK]
Quick Trick: grep outputs matching lines from here string input [OK]
Common Mistakes:
MISTAKES
  • Expecting only the matched word as output
  • Thinking no output if string is found
  • Confusing error messages with output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes