User Tools

Site Tools


technical_notes:public:bash-complete

Bash - Complete

#/bin/bash
 
function _mycomplete_()
{
    local cmd="${1##*/}"
    local word=${COMP_WORDS[COMP_CWORD]}
    local line=${COMP_LINE}
    local xpat='!*.foo'
 
    tmp=( $(compgen -W "$(ls ".foodir")" -- "${word}" ))
    COMPREPLY=$tmp
}
 
complete -F _mycomplete_ myfoo
technical_notes/public/bash-complete.txt · Last modified: 2015/08/17 20:54 by Fabien Arcellier