I am wondering if OSX is missing $READLINE_LINE
and $READLINE_POINT
variables in scripts? I have updated to bash 4.4 and from what I read it should be available. The function is called using bind -x
which should populate these variables in the function call. However, when I do so, they show as empty strings.
testreadline() {
echo $READLINE_LINE
echo $READLINE_POINT
}
bind -x '"\t": testreadline'
When I type some command and press the [TAB]
key, it prints 2 empty lines.
I should also mention that this works fine on my Linux VM, so I'm suspecting that there's something different with my Mac.
=========================================================================
EDIT:
The problem was when I updated to bash 4.4, I was still pointing my terminal to the old install of bash /bin/bash
. homebrew installs bash to /usr/local/bin/bash
so you will need to change your preferences/profile to point to that location.