Bird
0
0

You want to create a script that uses tab completion for a custom command mycmd. What must you do to enable tab completion for it?

hard📝 Application Q8 of 15
Linux CLI - Navigating the File System
You want to create a script that uses tab completion for a custom command mycmd. What must you do to enable tab completion for it?
AWrite and register a completion function and source it in the shell
BAdd the command to /etc/passwd
CRename the script to start with 'tab_'
DUse the command without any special setup; tab completion works automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand custom command tab completion setup

    Custom commands need a completion function that tells the shell how to complete arguments.
  2. Step 2: Identify how to enable completion

    Writing and registering a completion function and sourcing it enables tab completion for the custom command.
  3. Final Answer:

    Write and register a completion function and source it in the shell -> Option A
  4. Quick Check:

    Custom command completion = Write & register function [OK]
Quick Trick: Custom completions need functions registered in shell [OK]
Common Mistakes:
  • Editing /etc/passwd
  • Renaming script arbitrarily
  • Expecting automatic completion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes