When I answered this question , I used a very dirty bind function to change the current line according to the result of my automplete.sh script.
Since I used this script for personal use, I tried to simplify bind and will try to do all the reading and modification directly inside the script.
So far, I can access $READLINE_LINE and $READLINE_POINT and extract the data I need, but I cannot replace the current value. Quoting the bind mand page, this should work though:
When the shell is executed, the shell sets the READLINE_LINE variable to the contents of the readline string buffer and the READLINE_POINT variable to the current location of the insertion point. If the executed command changes the value of READLINE_LINE or READLINE_POINT, these new values โโwill be displayed in the editing state.
I associated my session with bind -x '"\t":autocomplete.sh' and did something like this:
#!/bin/bash
After the script is executed, the correct matches are displayed, but the current line feed is not updated. Since I am repeating some data, I cannot just redirect the output of my script to the bind part. Why can I read from variables but not write to it?
source share