Re: bash should consult .config/bash/...

2023-12-14 Thread Chet Ramey

On 12/10/23 1:32 AM, Koichi Murase wrote:


- interactive posix -> $ENV
- interactive non-posix -> N/A (hardcoded to be ~/.bashrc)


There isn't a variable, but you can specify it using the --rcfile command
line option.


- non-interactive posix -> N/A
- non-interactive non-posix -> $BASH_ENV


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: bash should consult .config/bash/...

2023-12-10 Thread Robert Elz
Date:Sun, 10 Dec 2023 18:59:22 +0300
From:=?UTF-8?B?T8SfdXo=?= 
Message-ID:  



  | There doesn't have to be a standard way; I'd set it in ~/.profile, you'd
  | set it wherever is convenient on your setup.

The point is that the people who want this don't want to have a ~/.profile
(or generally almost *any* "." files in $HOME).   So what you have as
~/.profile would instead be ~/.config/bash/profile (or something similar).

I've been using a DOTFILE env var for years for this purpose, and my
~/.bashrc file (for example) is a one-liner which contains:

test -r "${DOTFILE}/bash/rc" && . "${DOTFILE}/bash/rc"

(approximately).   It doesn't serve the purpose of eliminating the . files
from $HOME, but it does make it easier to find all the bash related config
files and more easily grep them to find which one contains something stupid.

It also makes it easier to move the entire config from one system to
another, without also accidentally moving piles of crap in other ~/.*
files that random other applications decided that they just *must* have
for their private storage.

kre





Re: bash should consult .config/bash/...

2023-12-10 Thread Oğuz
On Sunday, December 10, 2023, Koichi Murase  wrote:
>
> In that case, a question would be what would be the standard way to
> specify the Bash-specific variable,
>

There doesn't have to be a standard way; I'd set it in ~/.profile, you'd
set it wherever is convenient on your setup.


Re: bash should consult .config/bash/...

2023-12-09 Thread Koichi Murase
2023年12月10日(日) 13:23 Oğuz :
> 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



Re: bash should consult .config/bash/...

2023-12-09 Thread Oğuz
On Sunday, December 10, 2023, jidanni  wrote:

> Maybe on the list of config files bash looks at,
> there should be also .config/bash/... as that is
> the trend these days...
>

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.


-- 
Oğuz


Re: bash should consult .config/bash/...

2023-12-09 Thread Lawrence Velázquez
On Sat, Dec 9, 2023, at 10:28 PM, Koichi Murase wrote:
> 2023年12月10日(日) 12:10 jidanni :
>> Maybe on the list of config files bash looks at,
>> there should be also .config/bash/... as that is
>
> There was a discussion:
>
> https://lists.gnu.org/archive/html/bug-bash/2021-05/threads.html#00024
> https://lists.gnu.org/archive/html/bug-bash/2021-11/threads.html#00036

See also:

  - "Suggestion/question"
https://lists.gnu.org/archive/html/bug-bash/2021-06/threads.html#3

  - "[Suggestion] Relocate user startup files to their own subdirectory"
https://lists.gnu.org/archive/html/help-bash/2022-07/threads.html#1

PS: Wow, I didn't know the message links on the archive index pages
were all anchored.  That's nifty, and good to know.

-- 
vq



Re: bash should consult .config/bash/...

2023-12-09 Thread Koichi Murase
2023年12月10日(日) 12:10 jidanni :
> Maybe on the list of config files bash looks at,
> there should be also .config/bash/... as that is

There was a discussion:

https://lists.gnu.org/archive/html/bug-bash/2021-05/threads.html#00024
https://lists.gnu.org/archive/html/bug-bash/2021-11/threads.html#00036



bash should consult .config/bash/...

2023-12-09 Thread jidanni
Maybe on the list of config files bash looks at,
there should be also .config/bash/... as that is
the trend these days...