[wplug] need to find user HOME dir

Tim Lesher tim at lesher.ws
Tue Jul 1 01:22:26 EDT 2003


On Tue, Jul 01, 2003 at 01:11:09AM -0400, Alexandros Papadopoulos wrote:
> Ah, of course! Forgot the -w there...
> 
> HOMEDIR=`grep -w $USER /etc/passwd | cut -d ":" -f 6`

Actually, if you really have your heart set on grep, you'll want to do this:
HOMEDIR = `grep -w ^$USER /etc/passwd | cut -d ":" -f 6`

Otherwise, don't try looking for the home directory of UID 1
('bin') :-).  

Personally, I'd rather just use a tool that understands fields and be
done with it.

-- 
Tim Lesher <tim at lesher.ws>
http://www.lesher.ws




More information about the wplug mailing list