[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 5/8] builtins/source: parse the -i option
From: |
Andreas Kähäri |
Subject: |
Re: [PATCH v2 5/8] builtins/source: parse the -i option |
Date: |
Mon, 20 May 2024 20:06:42 +0200 |
On Mon, May 20, 2024 at 01:54:20PM -0400, Greg Wooledge wrote:
> On Mon, May 20, 2024 at 07:43:10PM +0200, Andreas Kähäri wrote:
> > On Mon, May 20, 2024 at 05:31:05PM +0000, Matheus Afonso Martins Moreira
> > wrote:
> > > >> Why not add a -p option to '.' to specify the path to search.
> > > >> That is
> > > >> . -p "${BASH_SEARCH_PATH-${PATH}}" file
> > > >> would work if someone decided to use the
> > > >> BASH_SOURCE_PATH var name to store the path to use
> > > >> (defaulting to $PATH if that one isn't set).
> > >
> > > > Believe it or not, I had thought of that as well.
> > > > It sidesteps the whole BASH_SOURCE_PATH
> > > > variable brouhaha altogether.
> > >
> > > I think this is a really good solution. I hadn't thought of it.
> > > Users can even make an alias to set a default for themselves.
> > >
> > > -- Matheus
> >
> > Or even
> >
> > PATH=${BASH_SEARCH_PATH-$PATH} . file
> >
> > without the need to add any options to . or to source. But maybe that
> > too pedestrian?
>
> Are we going in circles yet? This would clobber the value of PATH for
> the duration of sourcing "file", which would potentially cause commands
> in "file" to break.
>
> hobbit:~$ cat bar
> echo hi | cat
> hobbit:~$ PATH=. source bar
> bash: cat: command not found
So it is, at least if $BASH_SEARCH_PATH does not include $PATH.
I'll just go back to the sidelines and be quiet.
--
Andreas (Kusalananda) Kähäri
Uppsala, Sweden
.
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, (continued)
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Robert Elz, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Andreas Kähäri, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Greg Wooledge, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option,
Andreas Kähäri <=
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Phi Debian, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Greg Wooledge, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Phi Debian, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Koichi Murase, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, alex xmb sw ratchev, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Phi Debian, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Martin D Kealey, 2024/05/24
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Koichi Murase, 2024/05/24
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Lawrence Velázquez, 2024/05/24