簡體   English   中英

Cygwin無法執行shell腳本

[英]Cygwin can't execute shell script

我試圖在Windows 7上使用Cygwin執行.sh文件,我收到錯誤cannot execute binary file

這是我在Cygwin命令提示符窗口中編寫的內容:

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

這是結果:

/usr/bin/cygpath: /usr/bin/cygpath: cannot execute binary file

用雙引號( " )和整個cygpath命令用反引號( ` )括起你的Windows路徑。

我的例子:

> 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

運行以上:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM