2010-10-26

remove the ".exe" suffix of commands in bash on Cygwin when completing

Because I think the extra ".exe" takes too much space when multiple pipelines are used in a one-liner task.

Basically it's a small change to the file lib/readline/complete.c in bash's source code.

Find the definition of the function "make_quoted_replacement" and change the line

replacement = match;


to

if(strstr(match, ".exe") != NULL) {
replacement = (char *) xmalloc(strlen(match) - 4 + 1);
memset(replacement, 0, strlen(match) - 4 + 1);
strncpy(replacement, match, strlen(match) -4);
} else {
replacement = match;
}


Then recompile it to deploy.

没有评论: