function _ssh_connector_completion() { latest="${COMP_WORDS[$COMP_CWORD]}" words=$(grep -v -E "\#" $SSH_HELPER_HOST_LIST | awk '{print $1}') COMPREPLY=($(compgen -W "$words" -- $latest)) return 0 } function _scp_path_completition() { #COMPREPLY=(${COMP_WORDS}) COMPREPLY=($(scp-completion.py ${COMP_WORDS[*]} $COMP_CWORD)) return 0 } complete -F _ssh_connector_completion ssh-helper complete -o nospace -F _scp_path_completition scp-helper