The gethome() function retrieves the home directory for the specified user. This information is obtained from the home directory field of /etc/passwd or the NIS password map.
result = gethome([user]);
|user||Optional. The name of the user for which home directory information should be retrieved. If this argument is not specified, then the value of the runuser variable is used.|
A string that contains the specified user’s home directory from the home directory field of /etc/password or the NIS map. If the user is not found, then result contains a blank string.
result = gethome("JSmith");
In this example, the home directory for the user JSmith is returned in result. For example, /home/JSmith.