1 2 3 4 5 6
#compdef newgrp : ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}} # : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use NIS compadd $groups