# bash completion for brctl -*- shell-script -*- proc _brctl { local cur prev words cword _init_completion || return local command=$(words[1]) match $cword { with 1 setglobal COMPREPLY = ''( $( compgen -W "addbr delbr addif delif setageing setbridgeprio setfd sethello setmaxage setpathcost setportprio show showmacs showstp stp" -- "$cur" ) ) with 2 match $command { with show with * setglobal COMPREPLY = ''( $( compgen -W "$($1 show | \ awk 'NR>1 {print $1}' )" -- "$cur" ) ) } with 3 match $command { with addif|delif _configured_interfaces with stp setglobal COMPREPLY = ''( $( compgen -W 'on off' -- "$cur" ) ) } } } && complete -F _brctl -o default brctl # ex: ts=4 sw=4 et filetype=sh