Mailing List Archive

Support open source code!


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

Re: tlug: bash startup scripts



Well, I'm a zsh user. zsh has 4 levels of startup files:

first  /etc/zshenv    ~/.zshenv     read by all kinds of shells
       /etc/zprofile  ~/.zprofile   read by login shells
       /etc/zshrc     ~/.zshrc      read by interactive shells
last   /etc/zlogin    ~/.zlogin     read by login shells

I use only zprofile and zshrc. In zprofile I set all environment variables
I'd like to have. In zshrc I set the rest, like shell options and aliases.

The reason is that the environment variables are automatically copied
at process creation - there is no need to set them again when starting
a new shell (i.e. non-login interactive shell in an xterm).

There's only one exception - the prompt ($PS1 etc) is re-set even by
non-login shells. I put the corresponding statement in zshrc.

One possibly should set a basic PATH in zshenv, so that scripts using rsh do
work right. zshenv should contain the basic framework for
non-interactive shells.

Oh yes, and the basic rule "/etc/* for all users, ~/.* for me" also applies.

bash has a similar setup, although not as clear as zsh.
For some weird reason it does not read /etc/bashrc. The Red Hat guys solved
this problem by creating a ~/.bashrc for every user, sourcing /etc/bashrc.

-Klaus
----------------------------------------------------------------
Next Nomikai: 20 November, 19:30   Tengu TokyoEkiMae 03-3275-3691
Next Technical Meeting: 12 December, 12:30 HSBC Securities Office
----------------------------------------------------------------
more info: http://tlug.linux.or.jp Sponsors: PHT, HSBC Securities


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links