Forgot to mention that the technique to get TAB completion is pulled from another LQ thread
, thank you!
Anyway, i was hoping to get completion to work with the standard complete/compgen builtins instead of this history hack, but i couldn't for the life of me get those to work in the script whatsoever. I'd very,very much like to hear something about this working, as AFAICS it's truly an ugly part.
In this other LQ thread
"complete" is reported as working, though it didn't worked for me.
The other bit i'd like to get some help about is this command substitution:
allowed_commands="$(declare -f | sed -ne '/^[^_].* () /s/ ().*//p' | tr '\n' ' ')"
The last pipe (that of "tr") seems redundant. I know sed has the ability to transform the newlines to spaces...hopefully some sed warrior sheds some light here.