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.
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines