1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#compdef rlogin rsh ssh if [[ CURRENT -eq 2 ]]; if compset -P 1 '*@'; then _hosts else local nm=${compstate[nmatches]} _hosts [[ nm -eq compstate[nmatches] ]] && compgen -S @ -u fi elif [[ CURRENT -eq 3 ]]; then compadd - -l else compgen -S @ -u fi