Why can't Git Bash run my executable?

Pedro Sobota picture Pedro Sobota · Apr 22, 2015 · Viewed 59.7k times · Source

I am on git-for-windows Git Bash. I can't run an executable on the command line:

Pedr@Abc-07 MINGW64 /c/dev
$ ls sqlite3.exe
sqlite3.exe*

Pedr@Abc-07 MINGW64 /c/dev
$ sqlite3
bash: sqlite3: command not found

Why is it so?

Answer

Nattgew picture Nattgew · Apr 22, 2015

To run a program in the current directory in bash, you put ./ in front of it. So in your case:

$ ./sqlite3.exe

When you run sqlite3, bash will look for a program with exactly that name in all directories of the PATH environment variable, which by default includes standard locations for executables like /usr/local/bin but not your current directory. See here for more info on that.