[Bash-completion-devel] [patch] completions/ifconfig

Thilo Six T.Six at gmx.de
Sat Apr 6 21:41:53 UTC 2013


Hello

today i noticed there is no completion for ifconfig available.
I used 'completions/ifup' as starting point and created one.
Actually ifconfig could be included there, too.

Use this i you like.
-- 
Regards,
Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6  7C18 89A4 A2A0 C70B 1A8F

-------------- next part --------------
# ifconfig(8)

_ifconfig()
{
    local cur prev words cword
    _init_completion || return

    # don't complete past 2nd token
    [[ $cword -gt 2 ]] && return 0

    if [[ $cword -eq 1 ]]; then
	_available_interfaces
	COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
    else
	COMPREPLY=( $(compgen -W 'up down' -- "$cur") )
    fi

    return 0
} &&
complete -F _ifconfig ifconfig


More information about the Bash-completion-devel mailing list