Bird
0
0

Which of the following is the correct syntax to replace a placeholder string with input items using xargs?

easy📝 Syntax Q3 of 15
Linux CLI - Pipes and Redirection
Which of the following is the correct syntax to replace a placeholder string with input items using xargs?
Aecho 'file1 file2' | xargs -n {} rm
Becho 'file1 file2' | xargs rm -I {}
Cecho 'file1 file2' | xargs rm {} -I
Decho 'file1 file2' | xargs -I {} rm {}
Step-by-Step Solution
Solution:
  1. Step 1: Understand -I usage

    The -I {} option tells xargs to replace {} with each input item.
  2. Step 2: Check syntax correctness

    echo 'file1 file2' | xargs -I {} rm {} correctly places -I {} before the command and uses {} as placeholder.
  3. Final Answer:

    echo 'file1 file2' | xargs -I {} rm {} -> Option D
  4. Quick Check:

    Placeholder replacement syntax = echo 'file1 file2' | xargs -I {} rm {} [OK]
Quick Trick: -I {} replaces placeholder with input [OK]
Common Mistakes:
  • Placing -I after command
  • Using -n instead of -I for placeholders

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes