NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

'cd' if HOME is unset



Hello,

POSIX requires that the 'cd' command use the $HOME
environment variable (if that is set) when no operand
is given.

It explicitly notes that behavior of 'cd' with no
operand when $HOME is unset is implementation defined.
It then notes:

"A common extension when HOME is undefined is to get
the login directory from the user database for the
invoking user. This does not occur on System V
implementations."

I'm surprised that /bin/sh does not use the user's
home directory from getpwuid() in that case:

$ pwd
/tmp
$ unset HOME
$ cd
cd: HOME not set
$ pwd
/tmp
$

This is the same for /bin/ksh and /bin/csh as well.

Did all these somehow inherit this from System V or
was there a reason why this wasn't implemented?

-Jan


Home | Main Index | Thread Index | Old Index