Bird
0
0

Find the mistake in this script line:

medium📝 Debug Q7 of 15
Bash Scripting - Text Processing in Scripts
Find the mistake in this script line:
grep -i "Error" logfile.txt | grep -v
AMissing pattern after -v option
BUsing -i and -v together is invalid
CQuotes around Error should be single quotes
Dlogfile.txt should be before grep options
Step-by-Step Solution
Solution:
  1. Step 1: Understand -v option usage

    The -v option requires a pattern to invert matches; here it is missing.
  2. Step 2: Check the command pipeline

    The second grep lacks a pattern after -v, causing an error.
  3. Final Answer:

    Missing pattern after -v option -> Option A
  4. Quick Check:

    -v needs a pattern to invert [OK]
Quick Trick: Always provide a pattern after -v in grep [OK]
Common Mistakes:
MISTAKES
  • Omitting pattern after -v
  • Thinking -v can be standalone
  • Confusing quote types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes