On Jan 22, 2008 7:43 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote:

> # egrep "^bin:|^adm:|^daemon:|^root:|^rpm:" /etc/passwd
> root:x:0:0:Linux root:/root:/bin/bash
> bin:x:1:1:Linux bin:/bin:/sbin/nologin
> daemon:x:2:2:Linux daemon:/sbin:/sbin/nologin
> rpm:x:37:37:Linux :/var/lib/rpm:/sbin/nologin
>
> daemon is missing.
> # grep daemon passwd.all
> daemon:x:2:2:Linux daemon:/sbin:/sbin/nologin
> daemon:x:1:1:System account #8545740:/:
> but both get filtered out.

It looks as if those two both have UIDs and usernames that were in the
list above. Doesn't that mean that they *should* be filtered out?

> Why should be abything missing? I meant the code to keep the first
> copy of the duplicate and throw any identical after that. For example,
> if there are three "root" with UID "0" just keep the first and discard
> the other two.

So, you're throwing away those two because they're identical, in one
parameter, to the ones you've seen. That's why.

What about this data?

  fred:x:42:42:Fred Flintstone:/home/fred:/bin/bash
  barney:x:99:99:Barney Rubble:/home/barney:/bin/bash
  fred:x:69:69:Fred Astaire:/home/fred:/bin/bash
  dino:x:69:69:Dino:/home/dino:/bin/bash

As I understand your code, it will drop Fred Astaire for having a
username that had been seen before. Then, it will drop Dino, for
having a UID that had been seen before, even though the line with that
UID was itself dropped. Is that what you want it to do?

Maybe you can invent a better solution. For example, instead of
dropping users whose UID has been used elsewhere, perhaps they could
be assigned new UIDs; I imagine that would make the users happier.
Duplicate usernames aren't so simple as that, but aren't generally too
difficult to handle programmatically.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to