When I want to input the command echo $bash_
, then I press Tab
key, the autocompletion can't occur.
But when I input the command echo $BASH_
, then I press Tab
, the completion list will output like this:
$BASH_ALIASES $BASH_COMMAND $BASH_SOURCE
$BASH_ARGC $BASH_COMPLETION_COMPAT_DIR $BASH_SUBSHELL
$BASH_ARGV $BASH_LINENO $BASH_VERSINFO
$BASH_CMDS $BASH_REMATCH $BASH_VERSION
And my .inputrc
file contains the readline
ignorecase option, set completion-ignore-case on
, and the filename completion case insensitive is okay.
So, I want the variable name
tab completion can ignore the variable case.
There are case-insensitive filesystems, and on such systems it makes sense for filename completion to be case-insensitive. In an ideal world, bash could tell if a component of a filepath were case insensitive, but in practice there is no standard interface which provides this information, so bash falls back to letting you explicitly configure case-insensitive filename completion: (quote from bash manual, emphasis added)
completion-ignore-case
If set toon
, readline performs filename matching and completion in a case-insensitive fashion. The default value is ‘off’.
Similarly, you can configure glob expansion and/or case patterns to be case-insensitive.
But you cannot make bash variables case-insensitive. $bash
and $BASH
are different variables. Similarly with bash function names, bash builtin names and bash keywords. Bash can do tab-completion with all of those, but regardless of the configuration of filename case sensitivity, the tab-completion is case sensitive.
While that seems like a reasonable justification, it turns out that bash tab-completion is always case sensitive except for filenames (including directories and bash commands, which map onto filenames), which can be configured to be case-insensitive. Even things which are typically case-insensitive, like signal names and host names can only be completed case-sensitively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With