home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Unix Power ToolsUnix Power ToolsSearch this book

28.7. Don't Match Useless Files in Filename Completion

The shell variable fignore in csh and zsh (FIGNORE in bash and also zsh) lets you tell the shell that you aren't interested in some files when using filename completion (Section 28.6). For example, you may be 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 Section 35.9

% 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), ~ (Emacs backup files (Section 19.4)), and so on. Section 1.12 has a list of them. Here's how to set fignore to a list of filenames:[86]

[86]The ~ (for Emacs) has to be quoted ((Section 27.13) when it's stored in the fignore array. Otherwise, the shell would expand it to your home directory path (Section 31.11).

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

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 and JP

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.