How do I determine what version of readline I am using in my bash session?
I am wondering specifically because I appear to have the readline library 6.3, but the set enable-bracketed-paste on
in my .inputrc
is working, even though that feature was only added in readline 7.0.
I am using bash 4.4.0 on macOS 10.11 (installed with Fink).
Best Answer
There is no generally reliable method of determining the version of a statically linked library. However, in this case, I believe you can use the value of the
rl_readline_version
global variable.https://tiswww.case.edu/php/chet/readline/readline.html#SEC25
As of bash-2.05a and later, this is exposed as
rl_readline_version
as you can see here:https://git.savannah.gnu.org/cgit/bash.git/tree/NEWS?id=d233b485e83c3a784b803fb894280773f16f2deb#n1542
The easiest way I know to check this is with a debugger like
gdb
. For example:This means that my version of
bash
is running readline version 7.0.In case you are curious, the readline maintainer has explained the reason for static linking on Mac OS X here:
https://tiswww.case.edu/php/chet/bash/NOTES
Since
readline
is statically linked on Mac OS X,ldd
andotool
will not be helpful. However, for completeness, I will show you how it looks on Linux. Here is what mine looks like on Ubuntu 18.04:As you can see, the
ldd
output is also unhelpful in this case. So instead I usedstrace
:I believe the corresponding
dtrace
command would be:but I haven't tried it, so I can't say for sure. At this point, I can just grep the logfile for
readline
:So on Ubuntu 18.04 it is readline version 7, as expected.