# bash completion for mssh # Written by Héctor García _mssh_alias() { COMPREPLY=( $( compgen -W '$( command cat ~/.mssh_clusters 2>/dev/null \ | grep -v "^\s*$" | grep -v "^#" | sed -e "s/:.*$//" )' -- $cur ) ) } _mssh() { local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} COMPREPLY=() case "$prev" in -a) _mssh_alias return 0 ;; esac # completing -a option if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "-a" -- $cur ) ) return 0 fi _known_hosts_real "$cur" } complete -F _mssh mssh