Cygwin cannot execute shell script

I am trying to execute a .sh file with Cygwin on Windows 7 and I am getting cannot execute binary file error message.

Here is what I wrote on the Cygwin command prompt window:

 $ bash cygpath --unix C:\Users\\MyName\\Documents\\MyProject\\dygraphsMaster\\generate-combined.sh 

This was the result:

 /usr/bin/cygpath: /usr/bin/cygpath: cannot execute binary file 
+5
source share
1 answer

Include your Windows path with double quotes ( " ) and the entire cygpath with reverse windows ( ` ).

My example:

 > pwd /cygdrive/c/TestFolder/ScriptInsideHere > ls -al total 1 drwx------+ 1 Administrators Domain Users 0 Aug 25 13:08 . drwx------+ 1 Administrators Domain Users 0 Aug 25 13:13 .. -rwx------+ 1 Administrators Domain Users 29 Aug 25 13:08 hello_world.sh > cat hello_world.sh #!/bin/bash echo Hello World 

Run above:

 > bash `cygpath --unix "C:\TestFolder\ScriptInsideHere\hello_world.sh"` Hello World 
+1
source

Source: https://habr.com/ru/post/1201089/


All Articles