[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash should consult .config/bash/...
From: |
Koichi Murase |
Subject: |
Re: bash should consult .config/bash/... |
Date: |
Sun, 10 Dec 2023 15:32:16 +0900 |
2023年12月10日(日) 13:23 Oğuz <oguzismailuysal@gmail.com>:
> Trends come and go. If there is demand for this feature bash should do it
> by honoring an environment variable like BASH_HOME when looking for rc
> files instead of exploring a fixed path.
In that case, a question would be what would be the standard way to
specify the Bash-specific variable, BASH_HOME. We cannot set it in
~/.bashrc because it should be specified before Bash decides the
location of .bashrc.
- Maybe the package managers of distributions can specify the
configure option -DSYS_BASHRC and set BASH_HOME there. But, in that
case, ~/${XDG_CONFIG_HOME:-~/.config/bash}/bashrc could be directly
sourced from SYS_BASHRC, which is already possible with the current
Bash. Another problem is that if it is not set up by the package or
the system administrators, the user cannot use it.
- Besides, Zsh seems to support ZDOTDIR, which can be used to specify
the location of user configurations. The Zsh users seem to specify
ZDOTDIR in /etc/zshenv or /etc/zsh/zshenv. This approach has the
same problem that a user needs to ask a system administrator to
configure /etc/zshenv as the user likes.
By the way, even if we forget about `.config/bash', it may be more
consistent to have a variable like the suggested one. There are
already similar variables, ENV and BASH_ENV. However, the former is
only used in the interactive posix mode, and the latter is only used
in the non-interactive non-posix mode. There does not seem to be a
similar variable that can be used in the interactive non-posix mode
and the non-interactive posix mode.
- interactive posix -> $ENV
- interactive non-posix -> N/A (hardcoded to be ~/.bashrc)
- non-interactive posix -> N/A
- non-interactive non-posix -> $BASH_ENV
--
Koichi