Programmed Completion

tcsh allows programmed completions to be specified using the complete command, as shown below:

complete command word/pattern/list/suffix

command is the command to which the completion applies. The argument following the command is a completion rule that specifies how to complete a word or words from the command. Although the delimiter between parts of a completion rule is often a dash, it can be any character.

There may be more than one completion rule. Each rule has the parts listed below.

Part

Description

word

Specifies how to select words from the command. It must be p, c, n, C, or N (described below).

pattern

Deter mines to which words the rule applies.

list

The word list from which to choose completions. The available lists are described below.

suffix

An optional suffix to be added to completed words. If missing, a slash is added to completed directory names and a space otherwise. If present, should be a single character. If the character is the same as the delimiter between parts of the completion rule, no suffix is added to completed words.

The word specifier determines how pattern is interpreted. If word is p, pattern indicates the word position or positions to which the rule applies. Otherwise, pattern is a filename pattern and the rule applies to any word whose leftmost part is matched by the pattern.

word

Description

p

Position-based completion. pattern is a number or range of numbers specifying to which words the rule applies:

n         Word n
m-n       Words m through n
m*        

Get Using csh & tcsh now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.