在 Windows 环境中学习 UNIX Bash/Shell 脚本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18422087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 06:23:33  来源:igfitidea点击:

Learning UNIX Bash/Shell scripting on a windows enviornment

bashunixcygwin

提问by Amber Roxanna

I was just curious if there are any tools out there that would allow me to practice shell scripting without dual booting my computer to half windows and half UNIX. I've heard of Cygwin but is that truly UNIX ?

我只是很好奇是否有任何工具可以让我练习 shell 脚本,而无需将我的计算机双启动到半窗口和半 UNIX。我听说过 Cygwin 但那真的是 UNIX 吗?

回答by konsolebox

Install Cygwinor install a Linux system under a virtual machine with emulators like VirtualBox.

安装Cygwin或在虚拟机下安装 Linux 系统,并带有VirtualBox 等模拟器。

Cygwin is not completely UNIX but it would be enough with not-too-system related scripting. There are differences though compared to a true UNIX system e.g. process managing wouldn't really work well. /proc too I think doesn't work as expected.

Cygwin 不是完全的 UNIX,但它与不太系统相关的脚本就足够了。但是与真正的 UNIX 系统相比还是存在差异,例如进程管理不会真正有效地工作。/proc 也是我认为没有按预期工作。

回答by PanderZel

Cygwin is okay, but keep in mind that if you want to learn about UNIX, Cygwin won't help with learning about the Linux filesystem, which is important.

Cygwin 还可以,但请记住,如果您想了解 UNIX,Cygwin 不会帮助您了解 Linux 文件系统,这很重要。

回答by Mario Lenz

You could also have a look at How to develop in Linux-Like Shell (bash) on Windows?, maybe there are some helpful answers.

您还可以查看如何在 Windows 上使用类似 Linux 的 Shell (bash) 进行开发?,也许有一些有用的答案。

Personally, I think a Linux VM is your best option. Cygwin is a UNIX-like environment on top of Windows, it's not a UNIX emulator.

就个人而言,我认为 Linux VM 是您的最佳选择。Cygwin 是 Windows 之上的类 UNIX 环境,它不是 UNIX 模拟器。

回答by hyde

I generally install gitwith Windows installer. Not only it comes with bash (look for "git bash" in Start menu), it also comes with git(duh) and ssh.

我通常使用 Windows 安装程序安装git。它不仅带有 bash(在“开始”菜单中查找“git bash”),它还带有git(duh) 和ssh

Obviously that's not "truly unix", for that install Virtualbox and in it FreeBSD or some other *BSD (they are officially "unix", unlike Linux which is "just" unix-like).

显然,这不是“真正的 unix”,因为安装 Virtualbox 并在其中安装 FreeBSD 或其他一些 *BSD(它们是正式的“unix”,与“只是”类似 unix 的 Linux 不同)。