简体   繁体   English

如何通过Cygwin在Windows 7上运行.sh文件?

[英]How to run .sh file on Windows 7 through Cygwin?

I have to use a package on my Windows 7 OS but the package comes only with the .sh file so I have to use bash and hence Cygwin to run on my machine. 我必须在我的Windows 7操作系统上使用一个软件包,但软件包只带有.sh文件,所以我必须使用bash,因此Cygwin可以在我的机器上运行。

But I am kinda familiar with Windows but completely new to Cygwin and shell programming. 但我对Windows很熟悉,但对Cygwin和shell编程来说却是全新的。

Suppose I have a run.sh file in /cygdrive/c/Users/myUserName/Desktop/software/myPackage/bin , how should I run it in Cygwin? 假设我在/cygdrive/c/Users/myUserName/Desktop/software/myPackage/bin有一个run.sh文件,我应该如何在Cygwin中运行它?

Downloaded Cygwin and in the terminal I navigate to that directory and type run.sh enter but it complains 下载Cygwin并在终端中导航到该目录并输入run.sh enter但它会抱怨

$ run.sh
-bash: run.sh: command not found

I am asking this because I generally understand in Windows you can just navigate to the directory and run the .bat file and that's it? 我问这个是因为我通常在Windows中理解你可以导航到目录并运行.bat文件,就是这样吗?

How does this work for Cygwin? 这对Cygwin有什么用? Any suggestion are highly appreciated! 任何建议都非常感谢!

You can run it as: 您可以将其运行为:

bash run.sh

Or else: 要不然:

chmod +x run.sh
./run.sh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM