Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the format for the -F option of _path_files and compadd?

I'm passing several directories to _path_files:

_path_files -W "($base_directories)" -/

But some of those directory trees I don't want to complete for this particular command.

The documentation I can find for _path_files says it accepts a -F option—just like compadd, but I can't find the format to pass them in.

Twiddling around hasn't been very fruitful either.

I've tried, for example,

_path_files -W "($base_directories)" -/ -F shared; # shared still shows up
_path_files -W "($base_directories)" -/ -F "(shared)"; # barfs on that guy
share|improve this question
up vote 2 down vote accepted

That looks correct if you want to ignore shared at the root of the directory tree, i.e. if you're ignoring one of the $base_directories. But if you meant to ignore shared somewhere deeper in the hierarchy, you need -F "(shared **shared)". You can also put the patterns in an array, which will reduce the quoting pains.

local -a ignored base_directories
ignored=(shared '*/shared')
_path_files -W base_directories -/ -F ignored

There are examples in the standard distribution in _cvs and _darcs.

If this doesn't help, try investigating what's going on by adding set -x and set +x around the problematic code, or setopt local_options xtrace (a.k.a set -x and change options only for the duration of the current function).

share|improve this answer
hmmm. I thought I had tried all that. but it worked! thanks! – Michael Deardeuff Jun 6 '11 at 17:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.