BachoSeven / mimi

a better xdg-open - an active fork
MIT License
32 stars 2 forks source link

Sometimes uses incorrect environment variable. #4

Closed chaulkie closed 11 months ago

chaulkie commented 11 months ago

I found that when I used $TERM in mimi.conf, it was substituting the value of $COLORTERM instead of $TERM. Looking at the code I found the culprit at line 163:

app[$i]="$(env | grep "$program" | head -1 | cut -d = -f 2)"

grep "$program" will match not only the desired variable, but also those which have that variable name as a substring (either of the name or the value). Then head -1 | cut -d = -f 2 simply grabs the value of the first one listed.

This can be fixed quite simply:

app[$i]="$(env | grep "^$program=" | head -1 | cut -d = -f 2)"
BachoSeven commented 11 months ago

Thanks for the heads up, fixing it now!