What looks at the passwd file?

Jaap Akkerhuis jaap at cwi.nl
Sat Mar 26 01:34:39 AEST 1988


In article <4739 at aw.sei.cmu.edu> pdb at sei.cmu.edu (Patrick Barron) writes:
 > 
 > Does anyone know if any of the "standard" Unix utilites look at the passwd
 > file to determine your home directory, instead of looking at $HOME?  (except,
 > of course, authenication programs like login and su, which have to.)  How
 > about other commonly used non-standard software (e.g., Gnu Emacs, MH, etc.).
 > 
 > I'm referring to 4.2/4.3BSD derived systems here.
 > 
 > Thanks,
 > --Pat.

Trivial, see next bundle,

	jaap

# To unbundle, sh this file
echo phd.sh 1>&2
sed 's/.//' >phd.sh <<'//GO.SYSIN DD phd.sh'
-#!/bin/sh
-#
-# print home directory
-#
-
-if [ $# = 0 ]
-then
-	echo $HOME
-else
-	grep "^${1}:" /etc/passwd | sed -e 's/.*:.*:.*:.*:.*:\(.*\):.*/\1/'
-fi
//GO.SYSIN DD phd.sh



More information about the Comp.unix.wizards mailing list