Re: home directory

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

 



On Fri, 2008-12-19 at 14:55 -0800, Gordon Messmer wrote:
> Todd Denniston wrote:
> > Craig White wrote, On 12/19/2008 12:03 PM:
> >> getent passwd | grep $1 | awk -F: '{ print $6 }'
> ...
> > Thanks for that getent call suggestion, it simplifies one of my scripts 
> > greatly.
> 
> 
> The grep is useless, and should be discouraged.  Use something like this 
> instead:
> 
> getent passwd "$1" | awk -F: '{ print $6 }'
> or:
> getent passwd "$1" | cut -d: -f6
> 
> Calling "getent passwd" on a machine that uses LDAP as an NSS source 
> causes a full search of the directory, which can be very expensive on 
> large directories.  It's better not to make a habit of doing that.
> 
> Plus, the "grep" method fails if the username that you're searching for 
> is a substring of other usernames in the passwd database.
----
agreed on all accounts...I tossed out the grep idea just as a quick
thought and had doubts about the grep notion but I didn't have the time
to test out other ideas.

Craig

-- 
fedora-list mailing list
[email protected]
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux