On Sun, 25 Dec 2022, Michael Cheponis wrote:
> Maybe it should print "$HOME is not set" in that case?
Some shells do just that, some fail silently, and some figure it out w/o
$HOME set:
$ for s in /bin/{sh,csh,ksh} /usr/pkg/bin/{bash,zsh}; do \
echo "### ${s}"; ${s} -c "cd /tmp; unset HOME; c
Date:Mon, 26 Dec 2022 10:41:25 -0800
From:Michael Cheponis
Message-ID:
| Well, as a zsh user:
What zsh does you'd need to take up with zsh developers. But it is
one of 2 shells I tested which don't require HOME to be set for "cd".
zsh I am not all that surprise
Well, as a zsh user:
$ echo $HOME
/usr/mac
$ unset HOME
$ echo $HOME
$ zsh -c cd
$(no change in directory, no error msg)
also:
$ HOME=/usr/mac
$ echo $HOME
/usr/mac
$ (unset HOME; zsh -c cd)
$ (no error msg)
in all c
Date:Sun, 25 Dec 2022 15:33:57 -0800
From:Michael Cheponis
Message-ID:
| Maybe it should print "$HOME is not set" in that case?
Did you try it?
It is easy...
(unset HOME; sh -c cd)
or use ksh (or some other shell) instead of sh to test it.
Script star
Maybe it should print "$HOME is not set" in that case?
On Sun, Dec 25, 2022 at 2:52 PM Valery Ushakov wrote:
> On Sat, Dec 24, 2022 at 22:32:22 -0500, Jan Schaumann wrote:
>
> > Robert Elz wrote:
> > > Why bother?
> >
> > I happily admit that it's a rare edge case. I simply
> > find it surpris
On Sat, Dec 24, 2022 at 22:32:22 -0500, Jan Schaumann wrote:
> Robert Elz wrote:
> > Why bother?
>
> I happily admit that it's a rare edge case. I simply
> find it surprising that 'cd' gives up if HOME is
> unset. Seems unintuitive to me.
Some would say, "gives up", some would say it makes you
Date:Sat, 24 Dec 2022 22:32:22 -0500
From:Jan Schaumann
Message-ID:
| I happily admit that it's a rare edge case. I simply
| find it surprising that 'cd' gives up if HOME is
| unset. Seems unintuitive to me.
It is how it is defined to work, and always has bee
Robert Elz wrote:
> Why bother?
I happily admit that it's a rare edge case. I simply
find it surprising that 'cd' gives up if HOME is
unset. Seems unintuitive to me.
-Jan
Why bother?It is already clear that one cannot depend upon this
working, and nothing normally should ever have HOME unset, unless that
is done deliberately (perhaps even to prevent a simple "cd" from
going there).
kre
Jan Schaumann wrote:
> "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 ca
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
t
11 matches
Mail list logo