[Chapter 9] 9.9 Don't Match Useless Files in Filename Completion
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:35:01Z

#

| Chapter 9 Saving Time on the Command Line |

## 9.9 Don't Match Useless Files in Filename Completion

The shell variable fignore (FIGNORE in bash) lets you tell the shell that you aren't interested in some files when using filename completion (9.8). For example, you are more likely to refer to C language source files (whose names end with .c) than object files (.o files); you often need to edit your source files, while you may never need to look at your object modules. Set fignore to the suffixes that you want to ignore. For example, to ignore .o files in tcsh and csh, type:

    set ( )
    % set fignore=(.o)

Once you've done this, file completion will ignore your .o files when you press the TAB key (ESC in csh)-unless a .o file is the only match it can find.

Most likely, there's a whole list of suffixes that you don't care about: .o (object modules), .out (random executables), .gz (gzipped files), and so on. Article 1.17 has a list of them. Here's how to set fignore to a list of filenames:

>     % set fignore=(.o .out .gz)   ...tcsh, csh
>     $ FIGNORE='.o:.out:.gz'       ...bash

fignore has no effect when you press CTRL-d to get a listing of the files that match in csh and tcsh. Those shells always give you a complete list of all possible completions.

- ML, JP

9.8 Filename Completion: Faster Filename Typing |  | 9.10 Filename Completion Isn't Always the Answer