UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 9.8 Filename Completion: Faster Filename Typing Chapter 9
Saving Time on the Command Line
Next: 9.10 Filename Completion Isn't Always the Answer
 

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


Previous: 9.8 Filename Completion: Faster Filename Typing UNIX Power ToolsNext: 9.10 Filename Completion Isn't Always the Answer
9.8 Filename Completion: Faster Filename Typing Book Index9.10 Filename Completion Isn't Always the Answer

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System