Excellent! Where to begin?
Maybe use a shell loop, read the /etc/passwd file line by line, check the 7th field to see what shell it is, if any, and depending on which it is (or not), add the username (field #1 in the file) to a list (an array perhaps?) of "TO BE REMOVED" users. Once the passwd file has been processed, execute `userdel` on each of the usernames in your list of users to be removed.
Meanwhile, consider reporting your thread, and asking for a move to /Programming, if you agree it might be a better place for this topic.
Cheers & good luck!
OH and P.S. - colucix makes a VERY good point!! How will you know which users you can safely delete?
Last edited by GrapefruiTgirl; 11-25-2010 at 09:56 AM.