Bird
0
0

What is the output of the command:

medium📝 Command Output Q4 of 15
Linux CLI - Text Processing
What is the output of the command:
echo "banana" | tr 'an' '12'?
Ab21212
Bb12121
Cbanana
Db11111
Step-by-Step Solution
Solution:
  1. Step 1: Map characters 'a' and 'n' to '1' and '2'

    In the input 'banana', 'a' is replaced by '1' and 'n' by '2'.
  2. Step 2: Apply replacements to each character

    'b' remains 'b', 'a' becomes '1', 'n' becomes '2', so 'banana' becomes 'b12121'.
  3. Final Answer:

    b12121 -> Option B
  4. Quick Check:

    Character translation = b12121 [OK]
Quick Trick: Match each source char to target char positionally [OK]
Common Mistakes:
  • Swapping target characters
  • Not replacing all occurrences
  • Confusing character order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes