shell - How to set case-insensitive completion in a bash instance without Readline support -


i have bash instance without readline support, i.e. bash invoked --noediting option. reason bash instance used program.

the other program wants know how bash complete command line , issues compgen commands in bash shell, e.g.

compgen -o default 

this works in bash without readline support. here example: let's say, in directory 3 files:

img_1234.jpg about.html index.html 

the command compgen -o default i prints duly

img_1234.jpg 

however want switch case-insensitive completion. issue in shell

bind 'set completion-ignore-case on' 

and in bash instance with readline support expected: compgen -o default i prints

img_1234.jpg index.html 

however in bash instance without readline support bind command nothing , still img_1234.jpg match.

so, question is: how can set case-insensitive completion suggestions (when using compgen) in bash instance invoked without readline support?

test program:

#!/bin/bash set -e  echo "### case-sensitive" bash --noediting <<eof compgen -o default eof echo echo "### case-folding" bash --noediting <<eof bind 'set completion-ignore-case on' compgen -o default eof 

result:

### case-sensitive img_1234.jpg  ### case-folding bash: line 1: bind: warning: line editing not enabled img_1234.jpg index.html 

bash version:

gnu bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) 

if bash version different, consider upgrading, can't reproduce issue 4.3.11. (and you'll want redirect stderr bind command; left in can see it's being executed).


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -