On windows git bash, autocompleting does not work when using "./" syntax.

The autocomplete problem

When I work on Linux terminal, after "./", bash will complete the excutable file name.

But on the windows git bash terminal, the autocompleting feature will not work after "./".

Why?

The reason is, you can not make a script file "excutable" on git bash! For example, you can try to run chomd +x test.sh, and you will see that test.sh is still a non-excutable.

Solution

At the top of the script file, add this line:

#!/bin/bash

This special line is called Shebang. It tells bash how to run this script file.

Git bash can recognize this line and activate autocompleting.

This article is originally created by tooli.top. Please indicate the source when reprinting : https://www.tooli.top/posts/git_bash_run

Posted on 2023-04-14 Mail to author