[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use zsh as login shell
From: |
宋文武 |
Subject: |
Re: use zsh as login shell |
Date: |
Sat, 29 Nov 2014 11:24:13 +0800 |
User-agent: |
Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-unknown-linux-gnu) |
Ludovic Courtès <address@hidden> writes:
> 宋文武 <address@hidden> skribis:
>
>> Ludovic Courtès <address@hidden> writes:
>>
>>> 宋文武 <address@hidden> skribis:
>
> [...]
>
>>>> IMO, we should use `/etc/environment' for system variables:
>>>> LANG=en_US.UTF-8
>>>> PATH=/run/current-system/profile/bin:/run/setuid-programs
>>>> And add `pam_env.so' to /etc/pam.d/login, to make tty login work.
>>>>
>>>> With `/etc/profile', `/etc/zlogin' just:
>>>> source /etc/environment
>>>> to make `bash -l' and `zsh -l' work.
>>>
>>> Is ‘pam env’ needed at all if /etc/profile and /etc/zlogin are provided
>>> anyway?
>> Yes, it's redundant.
>> Now I think the better way is just provide /etc/environment.
>> then `bash -l' would take ~/.bash_profile and ~/.profile.
>> We can have a default ~/.bash_profile like:
>> source /etc/environment
>> export PATH=$PATH:$HOME/.guix-profile/bin
>
> Currently, the .bashrc skeleton sources /etc/profile.
>
> So, instead of what you suggest, what about having:
>
> 1. /etc/profile and /etc/zlogin (?) both source /etc/environment,
> which uses plain Bourne syntax.
>
> 2. PATH is defined in /etc/environment and includes
> ~/.guix-profile/bin.
/etc/environment is defined by pam_env to be a simple KEY=VAL file, with no
support for varibales substitute. If we do not use pam_env (linux specified?),
I think we should let /etc/zlogin source /etc/profile instead.
And we don't want /etc/zlogin when not using zsh at all,
IIUC while skeletons is configurable at the top os-expr, /etc/zlogin is
not.
>
> 3. The skeleton for ~/.bash_profile sources /etc/profile, /etc/bashrc,
> and ~/.bashrc.
>
> 4. The definition of PS1 is moved from /etc/profile to /etc/bashrc.
>
> 5. The skeleton for ~/.bashrc sources /etc/bashrc.
It seem too much, what I suggested is:
for login, su (pam_env): /etc/environment
for login shell: ~/.bash_profile, ~/.zlogin
for interactive: ~/.bashrc, ~/.zshrc
skeletons only installed when needed :)
>
> ?
>
> (I was reading the Bash manual to make sure (info "(bash) Bash Startup
> Files"), and as an exercise, I’ve cleaned up my own ~/.bashrc and
> ~/.bash_profile accordingly, which fixes the issue I reported a couple
> of weeks ago regarding ‘guix environment’.)
>
> Thanks,
> Ludo’.