petobens / trueline

Fast and extensible bash powerline prompt with true color and fancy icon support
MIT License
385 stars 36 forks source link

Propose Change for using in bash #27

Closed mipsou closed 3 years ago

mipsou commented 3 years ago

Fix error in arr bad index array

petobens commented 3 years ago

Hi @mipsou. Why is this needed? The current -1 index gets the last element of the array (which is the intended behaviour).

mipsou commented 3 years ago

Hi, Thank for your'sfast answer. "-1" gives a get error index in the "arr" array under linux RHEL6 bash 4.1: 2 It work perfectly now. I think a negative index is not permit.

mikacousin commented 3 years ago

Negative index was introduce with bash 4.2 (released in 2011) See: https://github.com/bminor/bash/blob/36f2c40/CHANGES#L3034-L3035

mipsou commented 3 years ago

Ok, Next time I did a PR with a bash version test greater than 4.1 to automatically change the index.

Thanks you

petobens commented 3 years ago

Merged (with a slightly modified commit message). Thanks!