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 <fxmb...@gmail.com> wrote:

>
>
> On Thu, May 16, 2024, 15:43 alex xmb sw ratchev <fxmb...@gmail.com> wrote:
>
>>
>>
>> On Thu, May 16, 2024, 14:37 Oğuz <oguzismailuy...@gmail.com> wrote:
>>
>>> On Wednesday, May 15, 2024, Chet Ramey <chet.ra...@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
>>>
>>

Reply via email to