Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Change directory on invocation of zsh
- X-seq: zsh-users 8063
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Michael Prokop <zsh@xxxxxxxxxxxxxxxxx>
- Subject: Re: Change directory on invocation of zsh
- Date: Sun, 17 Oct 2004 09:26:53 -0700 (PDT)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <2004-10-17T16-22-44@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2004-10-16T23-18-26@xxxxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.61.0410161942220.8058@xxxxxxxxxxxxxxxxxx> <2004-10-17T16-22-44@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Sun, 17 Oct 2004, Michael Prokop wrote:
> * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> [20041017 10:13]:
> > if (( EUID == 0 )); then
> > export HOME=/root
> > else
> > export HOME=/home/$LOGNAME
> > fi
>
> /etc/zsh/zshrc:cd:22: no such file or directory: /home/LOGIN
> $ echo $LOGNAME
> LOGIN
Hm. This means that one of the following occurred:
- getlogin() returned "LOGIN"
- getlogin() returned empty or null, and getpwuid() returned an entry for
the user named "LOGIN"
I'd have to guess this is a side-effect of autologin? Does it run as the
user "LOGIN"?
> I can't find the reason for this behaviour (inittab entries are the
> same and behaviour seems to change when booting system serveral
> times), but using `id -un` instead of $LOGNAME seems to fix it.
If you can't figure out how to get it to be consistent, I'd suggest adding
to /etc/zsh/zshenv this snippet:
[[ $LOGNAME == LOGIN ]] && LOGNAME=$(id -un)
Do that before the EUID/HOME snippet. Other things may be depending on
LOGNAME being set correctly, too.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author