[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed new program: getpwnam [Re: --format flag
From: |
Bob Proulx |
Subject: |
Re: proposed new program: getpwnam [Re: --format flag |
Date: |
Fri, 19 Dec 2003 22:54:56 -0700 |
User-agent: |
Mutt/1.3.28i |
Jim Meyering wrote:
> Bruce Korb wrote:
> > So, what do you think about adding POSIX library/sys calls as
> > a collection of command line utilities? We already have "stat",
> > but don't have "getpwnam". There are a few others.....
> I hesitate to add new tools that can be approximated with
> one-liners using e.g Perl
>
> $ perl -MUser::pwent -e '$pw=getpwnam "root" or die; print
> $pw->shell,"\n"'
> /bin/bash
I will use two commands but I think this is simpler.
getent passwd bob | awk -F: '{print$NF}'
/bin/bash
Obviously you can pick out whatever field you need using this.
> So, in this case it's probably worth it. I do like the idea of a
> getpwnam command, but am not sure that should be the name of the command.
> Obviously it's a good name from the consistency-with-library-name
> standpoint, but its mangled name is sort of reminiscent of `creat'.
> Suggested alternatives welcome.
How would this relate to the existing 'getent' from glibc? There
appears to be a lot of overlap. But getent seems to be more general.
getent passwd bob
bob:x:1000:1000:Bob Proulx,,,:/home/bob:/bin/bash
getent aliases root
root: bob
getent hosts 127.0.0.1
127.0.0.1 torment.proulx.com torment localhost
getent services ssh
ssh 22/tcp
Of course other systems like HP-UX don't have glibc and also don't
have 'getent' either because of this. Personally I would rather see
getent in coreutils so that it would be available on all of the
platforms that coreutils is available. And of course a getpwnam in
coreutils would be nice for similar reasons.
Bob
- --format flag, Chris Van Nuys, 2003/12/13
- Re: --format flag, Bruce Korb, 2003/12/16
- Re: --format flag, Jim Meyering, 2003/12/16
- Re: --format flag, Bruce Korb, 2003/12/16
- Re: --format flag, Bruce Korb, 2003/12/16
- proposed new program: getpwnam [Re: --format flag, Jim Meyering, 2003/12/18
- Re: proposed new program: getpwnam [Re: --format flag, Bruce Korb, 2003/12/18
- Re: proposed new program: getpwnam [Re: --format flag, Bruce Korb, 2003/12/30
- Re: proposed new program: getpwnam [Re: --format flag,
Bob Proulx <=