readonly inconsistency with arrays

2024-06-03 Thread Will Allan via Bug reports for the GNU Bourne Again SHell
I'm seeing what appears to be an inconsistency with using `readonly` on variables declared in a previous scope. declare stringdeclare -i intdeclare -a array init_vars () {  readonly string="foo"  readonly int=100  readonly array=(1 2)   # Print the (hopefully) readonly variables  declare -p strin

Re: proposed BASH_SOURCE_PATH

2024-06-19 Thread Will Allan via Bug reports for the GNU Bourne Again SHell
Thanks for clarifying! I wondered if I was missing something, but kept seeing `${BASH_SOURCE[0]/%/*}` suggested in the thread, which I pointed out is flawed. I guess what I want is a "BASH_SOURCE_DIR" variable or something like it, mainly to avoid the boilerplate, variable, and/or command substi