Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Change directory on invocation of zsh



Hello,

I'm using the latest zsh version of debian unstable (4.2.1).
I'm using rungetty on one of my systems.
My /etc/inittab looks like this:


1:12345:respawn:/bin/zsh --login -c "/usr/bin/grml-start ; /usr/bin/grml-screen" >/dev/tty1 2>&1 </dev/tty1
[...]
5:2345:respawn:/sbin/rungetty tty5 -u grml -g grml --autologin grml /bin/zsh


So I'm able to use autologin without doing login stuff.

My problem: when starting zsh my working directory is '/'.
Not just as user root but also as user 'grml'.

AFAIK the pam_env module is responsible for doing some basic
enviroment handling.  Because I don't use the PAM system I've a
little wrapper in my zsh config:

  ,---- [ /etc/zsh/zshrc ]
  | if [[ -z "$HOME" || "$HOME" == "/" ]] ; then
  |   if [[ `id -un` == "root" ]] ; then
  |      export HOME=/root
  |   else
  |      export HOME=/home/`id -un`
  |   fi
  | fi
  `----

Of course running 'cd' or 'cd $HOME' or 'cd ~' changes into my
homedirectory. But I'd like to change path already on login.
Doing something like '[ $SECONDS == "0" ] && cd $HOME' is a
workaround but changes the working directory to $HOME any time I'm
starting a new zsh. Am I on the wrong way?
Any ideas or any hints? Thanks!

thx && regards,
(-: Michael



Messages sorted by: Reverse Date, Date, Thread, Author