Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an account on a shared machine, and cannot access /usr/bin, where there are many programs which I never use.

I'd like tabbing to ignore many of these programs, for example I'd like on<TAB> to complete to oneprog but there are other matches.

~> on
on_ac_power           oneprog          onto2vocabularyclass 

Is there a way to hide the other two matches, short of creating a mirror of /usr/bin?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Assuming bash...

You can define your own autocomplete rules for options/arguments, using complete. You can define filename suffices that are ignored in arguments by exporting variable $FIGNORE.

However, I don't think you can alter the way bash resolves program names.

You could, of course, alias the program you want to run, so you don't have to type so much:

[me@host ~]$ alias on=oneprog
[me@host ~]$ on

You could (if you were feeling silly) alias the bash builtin, command and use complete to define the arguments it will accept (your list of nice programs), and then always remember to type your alias before your real command.

[me@host ~]$ alias run=command
[me@host ~]$ complete -W "ls cd" run
[me@host ~]$ run ls

http://unix.stackexchange.com/questions/12694/how-to-have-autocomplete-ignore-a-specific-completion

share|improve this answer
    
Thanks, that link was especially useful. As much as I'd normally keep pushing, my reaction to "don't do it, just use an alias" seems to be identical to the author of the linked question, who eventually accepted the answer. –  Gyppo Apr 24 at 10:31

Your Answer

 
discard

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.