Is there a way to have a COMPREPLY return colored output? I can get it to work when readline recognizes the output as a folder when I have bind "set colored-stats on", but I can't make my own colors.

I tried using



COMPREPLY[i]=$(printf "%b%s%b" "\x01\E[01;34m\x02" "${COMPREPLY[i]}" "\x01\E[0m\x02")

but the first prints those characters literally and the second prints ^A^[[0m^B for all options. Removing the \[ \] wrappers makes every option be ^[[0m

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.