On Thu, 3 Jan 2002, Petre Scheie wrote:
> How about this:
>
> cp filename `grep $1 /etc/passwd |cut -d: -f6`
Yes and no. On a small system, sure. But on a machine with a lot of
users, you might get a false positive off of a partial match, or a match
from a different field of another user entry.
I would recommend:
cp filename `grep "^$1:" /etc/passwd |cut -d: -f6`
That forces grep to only look in the first field (the username), and to
examine the entire field.
Great idea, but potentially a problem.
Jima