1 2 3 4 5 6 7 8 9 10 11 12
#autoload local expl ports if ! _style ports ports ports; then (( $+_cache_ports )) || : ${(A)ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ ]*}} ports=( "$_cache_ports[@]" ) fi _wanted ports expl port && compadd "$@" "$expl[@]" - "$ports[@]"