5

I am trying to execute a .sh file with Cygwin on Windows 7, and I'm getting an error cannot execute binary file.

Here is what I wrote in 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
1
  • What are the permissions of your file? The first 3 letters should be rwx. Commented Aug 25, 2014 at 18:13

1 Answer 1

1

Enclose your Windows path with double quotes (") and your entire cygpath command with backticks (`).

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

Running the above:

> bash `cygpath --unix "C:\TestFolder\ScriptInsideHere\hello_world.sh"`
Hello World
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.