[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q
Well everybody think this is a trevial question ???
well in /etc/passwd, if you leave one empty line,
all users in the next lines are ignored !!!
so doing grep ^$USER_NAME_I_SEARCH: /etc/passwd will give
a wrong answer
Regards
Erez
Alexander L. Belikoff wrote:
> Erez Doron <erez@savan.com> writes:
>
> >
> > Hi
> >
> > does anybody knows of a unix command that
> > checks if a there is such a user on the system ?
> >
> > i meen that I'll ask if there is a username 'yossi' or 'moshe'
> > on this host, and I'll get an answer
> >
>
> Yes Virginia, there is one:
>
> awk -F: '{print $1}' /etc/passwd | grep USER_NAME_YOU_SEARCH
>
> ie (for b*sh/ksh):
>
> userp () { awk -F: '{print $1}' /etc/passwd | grep "^$1$";}
>
> --
> Alexander L. Belikoff
> Berger Financial Research Ltd.
> abel@bfr.co.il
- Follow-Ups:
- Re: Q
- From: abel@bfr.co.il (Alexander L. Belikoff)
- Re: Q
- From: Oleg Goldshmidt <goldshmt@netvision.net.il>
- References:
- Q
- From: Erez Doron <erez@savan.com>
- Re: Q
- From: abel@bfr.co.il (Alexander L. Belikoff)