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}
zsh -c cd
| $(no change in directory, no error msg)
No error message, yes, but are you sure there was no change in
directory? (Even if that change was into the directory it started from).
jacaranda$ (cd /; unset HOME; zsh -c 'cd; pwd')
/home/kre
Looks like it changed directory to me (from
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
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 i
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
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
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
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
o 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 sam
11 matches
Mail list logo