如何让Linux命令和脚本在Cygwin上运行?

时间:2021-11-11 07:11:30

I recently installed Cygwin and some of the packages that come with it so I could run my scripts which I created in a Linux environment. Now I am trying some commands which I use in the Linux environment like the iostat, free and ifconfig but they won't work. So my questions are:

我最近安装了Cygwin及其附带的一些软件包,因此我可以运行我在Linux环境中创建的脚本。现在我正在尝试一些我在Linux环境中使用的命令,如iostat,free和ifconfig,但它们不起作用。所以我的问题是:

Why won't some commands work? Where should my scripts reside? And should they have an extension of .bat or should I let them keep their extension .sh?

为什么有些命令不起作用?我的脚本应该驻留在哪里?如果他们有.bat的扩展名,或者我应该让他们保留他们的扩展名.sh?

Thanks guys! I really hope you could help me with this one.

多谢你们!我真的希望你能帮我这个。

1 个解决方案

#1


1  

Cygwin doesn't have all the same commands as regular Linux. It's about as good an approximation as you're going to get on Windows though. To get better replication I had to make tons of aliases and functions just to get it to my liking, but even that still falls short.

Cygwin没有与常规Linux相同的命令。尽管如此,它与你将要获得的Windows一样接近。为了获得更好的复制,我必须制作大量的别名和函数才能让它符合我的喜好,但即便如此仍然不足。

As far as the shell scripts, I would leave the original extension. And open it with Cygwin but like I mentioned before, since not all commands are supported, your script might not be supported either.

至于shell脚本,我会留下原始扩展名。并使用Cygwin打开它,但就像我之前提到的那样,因为并非所有命令都受支持,所以您的脚本也可能不受支持。

#1


1  

Cygwin doesn't have all the same commands as regular Linux. It's about as good an approximation as you're going to get on Windows though. To get better replication I had to make tons of aliases and functions just to get it to my liking, but even that still falls short.

Cygwin没有与常规Linux相同的命令。尽管如此,它与你将要获得的Windows一样接近。为了获得更好的复制,我必须制作大量的别名和函数才能让它符合我的喜好,但即便如此仍然不足。

As far as the shell scripts, I would leave the original extension. And open it with Cygwin but like I mentioned before, since not all commands are supported, your script might not be supported either.

至于shell脚本,我会留下原始扩展名。并使用Cygwin打开它,但就像我之前提到的那样,因为并非所有命令都受支持,所以您的脚本也可能不受支持。