[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: invoke tilde expansion on quoted string

From: Bob Proulx
Subject: Re: invoke tilde expansion on quoted string
Date: Tue, 9 Apr 2013 11:01:49 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Greg Wooledge wrote:
> Linda Walsh wrote:
> > Greg Wooledge wrote:
> > > getent(1) is fine where it's available, but it's not a standard tool,
> > > so you can only use it on systems that have it.
> > Have you encountered it on other linux systems?
> It is present on Debian 3.1 (the oldest Debian system to which I have
> access), OpenBSD 5.2, and Red Hat Enterprise Linux 5.7.  It would require
> some digging to find out exactly when it first appeared on each of those
> operating systems.
> For comparison, it is NOT present on Red Hat 5.2 ("Apollo").  The one
> from the 1990s, not RHEL 5.2.  I utterly despise the fact that it takes
> me three sentences to explain a version number.

I am pretty sure that getent is not available on HP-UX for an example
of a classic legacy Unix system.  For examples where getent is not
present I wouldn't go looking at old GNU/Linux systems but on legacy
Unix systems.  Because those tend to be impossible to upgrade and so
are often using a variety of releases.  For example HP-UX 10.20 (the
best release ever) is still in use and it is ancient. :-)

> That's just asking for trouble.  I don't know every arcane Unix
> authentication system out there, but I'd imagine at least one of them
> can't be used that way.  Plus, there's the issue of determining which
> authentication system you're actually supposed to pull the account
> information from.
> imadev:~$ grep '^wooledg' /etc/passwd
> Oh, look.  I'm not in /etc/passwd.  No, wait, maybe I am:
> imadev:~$ grep '+\{0,1\}wooledg' /etc/passwd
> +wooledg::-24:-24:::/usr/local/bin/bash
> Right, the plus sign means I'm really in NIS:

Actually you still need one more thing.  You need to look in the
/etc/nsswitch.conf file for the "passwd" entry and look to see if it
says "compat" for the '+' to be working.  Or if it says lists "nis" or
"nis+" in the fields.  And if so then the order specifies priority.
And there are other options too that would be required to be parsed to
be 100% correct.

> imadev:~$ ypmatch wooledg passwd.byname | awk -F: '{$2="xxxx"; OFS=":"; 
> print}'
> wooledg:xxxx:563:22:Greg Wooledge:/net/home/wooledg:/bin/ksh
> So to get my home directory by mimicking the operating system's account
> lookup procedures, I have to make at least 3 separate checks, and I may
> have to merge data from 2 of those.

We are now up to at least four checks.  :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]