Unix Programming - How to get home directory of specified user?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2004 > How to get home directory of specified user?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to get home directory of specified user?
Stone

2004-05-18, 12:34 am

Hi,

I need get full path name for a specified user's directory.
For example, I need get the full path name "/home/John/temp" for "~John/temp".

Is there any function for that?

Thanks
Paul J

2004-05-18, 12:34 am

Stone wrote:

> Hi,
>
> I need get full path name for a specified user's directory.
> For example, I need get the full path name "/home/John/temp" for
> "~John/temp".
>
> Is there any function for that?
>
> Thanks


You could just type:
ls -d ~username

Paul J
Barry Margolin

2004-05-18, 1:36 am

In article <d3a92589.0405172008.791bd0ab@posting.google.com>,
diaolsbit@sohu.com (Stone) wrote:

> Hi,
>
> I need get full path name for a specified user's directory.
> For example, I need get the full path name "/home/John/temp" for "~John/temp".
>
> Is there any function for that?
>
> Thanks


getpwnam()

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com