help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] How to keep only files match the prefix when do command comp


From: Peng Yu
Subject: [Help-bash] How to keep only files match the prefix when do command completion?
Date: Tue, 13 Dec 2011 16:52:07 -0600

Hi,

I have the following defined in bash. I'd like to complete commands for unsion by completing the profile files in ~/.unsion.

~$ complete -p unison
complete -o nospace -F _unison_command unison
~$ type _unison_command
_unison_command is a function
_unison_command ()
{
    COMPREPLY=(`find ~/.unison -name '*.prf' -printf '%f\n'`);
    return 0
}

When I type the following, it shows up every *.prf file in ~/.unison. I checked the usage in /etc/bash_completion, I don't see if I did anything obviously wrong. Yet, /etc/bash_completion can correctly do filtering, for example 'finger'.

unison some_prefix<TAB>

Could anybody let me know how to filter the command completion automatically? Thanks!


--
Regards,
Peng

reply via email to

[Prev in Thread] Current Thread [Next in Thread]