Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell scripts with Git Bash 64-bit on Windows

I've installed Git Bash 2.5.1 64-bit on a fresh Windows 10 machine:

mark@Foo MINGW64 ~/Documents/FsCheck (master)
$ git --version
git version 2.5.1.windows.1

When I list the contents of a directory, I can see a shell script:

mark@Foo MINGW64 ~/Documents/FsCheck (master)
$ ls
appveyor.yml  build.cmd  build.sh*         Docs/
bin/          build.fsx  Contributors.txt  examples/  FsCheck.sln

(Some files and folders removed for clarity.)

Notice that the shell script build.sh has an asterisk after the extension. In the console, it's also coloured green, where other files are light grey. I haven't seen this before, so I don't know if it means anything.

When I try to run the script, I get an error message:

mark@Foo MINGW64 ~/Documents/FsCheck (master)
$ build.sh
bash: build.sh: command not found

Also, there's no tab completion for any of the build files.

How can I run the shell script from Git Bash?

like image 618
Mark Seemann Avatar asked Sep 01 '15 11:09

Mark Seemann


1 Answers

You probably have ls aliased to ls -F. So when an trailing asterisk appears that means that the file is executable.

In POSIX systems, you can't directly execute files in current directory (for safety reasons). If you want to, you can use this trick:

./build.sh
like image 114
pacholik Avatar answered Sep 18 '22 06:09

pacholik