Is there a configuration option in Cygwin so that when Bash completes the name of the command, the filename’s
.exe suffix is ignored (not included)?
Explanation of the problem
When using tab completion in Bash on a Cygwin system to complete the name of a command, the
.exe extension is appended to the command name, e.g, typing
opens and pressing Tab completes the command to
The command runs fine (with MS Windows the
.exe extension is optional when running a command) but the problem is that the
_openssl() completion function provided by the
bash-completion package is only configured to provide completions of arguments for
openssl – not
openssl.exe. For example:
$ complete -p openssl openssl.exe complete -o default -F _openssl openssl bash: complete: openssl.exe: no completion specification
The same issue exists when trying to complete arguments for all executable commands.
I currently use Bash with Emacs mode configured for Readline editing so I can press Esc followed by two Backspace presses to remove the
.exe suffix before I start to type the arguments for the command. Ideally, I’d like to avoid having to do this every time I run a command.
What I’ve tried/researched
I figured that is probably not possible without modifying the source code of the Cygwin DLL or of Bash’s command completion (
pcomplete.c). However, I notice that the Bash builtins,
command automatically strip the
.exe suffix from the names of executable files, e.g.,
$ type -a openssl openssl is /usr/bin/openssl $ command -v openssl /usr/bin/openssl
It seems that Bash running in Cygwin has some mechanism for providing the bare command name (without the
.exe extension). However, I’ve been at a loss as to how – or if – this can be used to omit the file extension when completing commands.