Created
April 24, 2018 18:02
-
-
Save cmccandless/1cd6257e1c0433ce01cebd71611811b2 to your computer and use it in GitHub Desktop.
ifconfig bash completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ifconfig() | |
{ | |
local cur prev interfaces | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
case "${COMP_CWORD}" in | |
1) interfaces=$(ifconfig | grep -oP "^\w+") ;; | |
esac | |
COMPREPLY=( $(compgen -W "${interfaces}" -- ${cur}) ) | |
} | |
complete -F _ifconfig ifconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment