_devices_loopback() { local curw COMPREPLY=() curw=${COMP_WORDS[COMP_CWORD]} prev="${COMP_WORDS[COMP_CWORD-1]}" COMPREPLY=($(compgen -W "$(cat ~/.bashrc | grep -A 50 "openlo(" | grep ')' | grep -v '{' | awk '{print $1}' | tr -d ')')" -- $curw)) return 0 } complete -F _devices_loopback -o dirnames openlo