top | item 42113233

(no title)

dbtablesorrows | 1 year ago

You are probably missing a $ before COLUMNS and export before setting DELTA_FEATURES

discuss

order

wlonkly|1 year ago

Bash is funny with the -gt, -lt etc. operators and the [[ ]] builtin -- bash treats them as arithmetic operators like it does with math in $(( )), and so you provide them the variable name, not the value.

    $ TEST=3
    $ if [[ TEST -gt 2 ]]; then echo "honk"; fi
    honk
    $ TEST=1
    $ if [[ TEST -gt 2 ]]; then echo "honk"; fi
    $
That lets you do things like

    $ if [[ TEST*3 -gt 6 ]]; ...
without having to nest even more double parentheses.

You're correct about having to export DELTA_FEATURES at least once. (I export it outside of the function, but no harm in doing so whenever it's set -- but it's not required to re-export it when you change the value.) Thanks for catching that!