See the following reproduce example: $ cat ssh_compspec COMP_WORDBREAKS=${COMP_WORDBREAKS//[=:]/}
function _ssh() { local cur="$2" pre="$3" local options=( ProxyCommand='/usr/bin/nc -x host:port %h %p -X 5' ProxyCommand='/usr/bin/nc -x host:port %h %p -X connect' ConnectTimeout=10 ) local i saveIFS="$IFS" if [[ $pre == '-o' ]]; then for ((i=0; i < ${#options[@]}; ++i)); do options[i]=$( printf '%q' "${options[i]}" ) done IFS=$'\n' COMPREPLY=( $( compgen -W "${options[*]}" -- "$cur" ) ) IFS=$saveIFS fi } complete -F _ssh -o filenames ssh $ . ./ssh_compspec Then, $ ssh -o <Tab><Tab> ConnectTimeout=10 nc -x host:port %h %p -X 5 nc -x host:port %h %p -X connect As we can see, "ProxyCommand" is missing. But this works fine: $ ssh -o P<Tab> $ ssh -o ProxyCommand=/usr/bin/nc\ -x\ host:port\ %h\ %p\ -X\