[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed BASH_SOURCE_PATH
From: |
alex xmb sw ratchev |
Subject: |
Re: proposed BASH_SOURCE_PATH |
Date: |
Thu, 16 May 2024 15:48:43 +0200 |
maybe this one
[[ $BASH_SOURCE == /* ]] &&
medir=${BASH_SOURCE%/*} || {
[[ $BASH_SOURCE != */* ]] &&
medir=$PWD ||
medir=$PWD/${BASH_SOURCE%/*}
}
On Thu, May 16, 2024, 15:45 alex xmb sw ratchev <fxmbsw7@gmail.com> wrote:
>
>
> On Thu, May 16, 2024, 15:43 alex xmb sw ratchev <fxmbsw7@gmail.com> wrote:
>
>>
>>
>> On Thu, May 16, 2024, 14:37 Oğuz <oguzismailuysal@gmail.com> wrote:
>>
>>> On Wednesday, May 15, 2024, Chet Ramey <chet.ramey@case.edu> wrote:
>>>
>>> > is it more common to have
>>> > something like the script in somewhere/bin, files to be sourced in
>>> > somewhere/lib, and so on?
>>>
>>>
>>> Not sure how common but this is what makes sense. Or name sourceables
>>> foo.sh, bar.sh and executables foo, bar so they don't clash and source
>>> with
>>> `${BASH_SOURCE%/*}' prepended to PATH and it'll work fine.
>>>
>>
>> [[ $BASH_SOURCE == /* ]] &&
>> medir=${BASH_SOURCE%/*} ||
>> medir=$PWD/${BASH_SOURCE%/*}
>>
>> declare -p medir
>>
>
> sorry there is bug ..
>
>
>> This feature request sounded promising at first, it feels like
>>> bike-shedding now.
>>>
>>>
>>> --
>>> Oğuz
>>>
>>
Re: proposed BASH_SOURCE_PATH, Robert Elz, 2024/05/15
Re: proposed BASH_SOURCE_PATH, Matheus Afonso Martins Moreira, 2024/05/14