PowerShell 准备好替换 Windows 上的 Cygwin shell 了吗? [英] Is PowerShell ready to replace my Cygwin shell on Windows?

查看:51
本文介绍了PowerShell 准备好替换 Windows 上的 Cygwin shell 了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在争论是应该学习 PowerShell,还是坚持使用 Cygwin/Perl 脚本/Unix shell 脚本等

I'm debating whether I should learn PowerShell, or just stick with Cygwin/Perl scripts/Unix shell scripts, etc.

PowerShell 的好处是没有 Cygwin 的队友可以更轻松地使用脚本;但是,我不知道我是否真的会编写那么多通用脚本,或者人们是否会使用它们.

The benefit of PowerShell would be that the scripts could be more easily used by teammates that don't have Cygwin; however, I don't know if I'd really be writing that many general purpose scripts, or if people would even use them.

Unix 脚本如此强大,PowerShell 是否足够接近以保证切换?

Unix scripting is so powerful, does PowerShell come close enough to warrant switching over?

以下是我将在 PowerShell 中寻找的一些特定内容(或等效内容):

Here are some of the specific things (or equivalents) I would be looking for in PowerShell:

  • grep
  • 排序
  • uniq
  • Perl(PowerShell 与 Perl 的功能有多接近?)
  • AWK
  • sed
  • file(给出文件信息的命令)

推荐答案

工具只是工具.
他们帮助或不帮助.
您需要帮助或不需要.

Tools are just tools.
They help or they don't.
You need help or you don't.

如果您了解 Unix 并且这些工具可以在 Windows 上完成您需要它们做的事情 - 那么您就是一个快乐的人,无需学习 PowerShell(除非您想探索).

If you know Unix and those tools do what you need them to do on Windows - then you are a happy guy and there is no need to learn PowerShell (unless you want to explore).

我的初衷是在 Windows 中包含一组 Unix 工具并完成它(我们团队中的一些人具有深厚的 Unix 背景并且对该社区抱有一定的尊重.)

My original intent was to include a set of Unix tools in Windows and be done with it (a number of us on the team have deep Unix backgrounds and a healthy dose of respect for that community.)

我发现这并没有多大帮助.原因是 AWK/grep/sed 对 COMWMIADSI、注册中心、证书存储区等

What I found was that this didn't really help much. The reason for that is that AWK/grep/sed don't work against COM, WMI, ADSI, the Registry, the certificate store, etc., etc.

换句话说,UNIX 是一个围绕文本文件自我调整的整个生态系统.因此,文本处理工具是有效的管理工具.Windows 是一个完全不同的生态系统,可以围绕 API 和对象进行自我调整.这就是我们发明 PowerShell 的原因.

In other words, UNIX is an entire ecosystem self-tuned around text files. As such, text processing tools are effectively management tools. Windows is a completely different ecosystem self-tuned around APIs and Objects. That's why we invented PowerShell.

我认为您会发现,在很多情况下,文本处理无法在 Windows 上获得您想要的东西.那时,您将需要使用 PowerShell.注意 - 这不是一个全有或全无的交易.在 PowerShell 中,您可以调用您的 Unix 工具(并使用它们的文本处理或 PowerShell 的文本处理).您也可以从 Unix 工具调用 PowerShell 并获取文本.

What I think you'll find is that there will be lots of occasions when text-processing won't get you what you want on Windows. At that point, you'll want to pick up PowerShell. NOTE - it is not an all or nothing deal. Within PowerShell, you can call out to your Unix tools (and use their text process or PowerShell's text processing). Also you can call PowerShell from your Unix tools and get text.

再说一遍 - 这里没有宗教信仰 - 我们的重点是为您提供成功所需的工具.这就是为什么我们如此热衷于反馈.让我们知道我们在工作中的不足之处,或者您没有需要的工具,我们会将其列在清单上并开始使用.

Again - there is no religion here - our focus is on giving you the tools you need to succeed. That is why we are so passionate about feedback. Let us know where we are falling down on the job or where you don't have a tool you need and we'll put it on the list and get to it.

老实说,我们正在把自己从一个 30 年的坑里挖出来,所以这需要一段时间.也就是说,如果您选择 Windows Server 2008/R2 的测试版和/或我们的服务器产品,我想你会惊讶于这个漏洞被填满的速度有多快.

In all honesty, we are digging ourselves out of a 30-year-hole, so it is going to take a while. That said, if you pick up the beta of Windows Server 2008 /R2 and/or the betas of our server products, I think you'll be shocked at how quickly that hole is getting filled.

关于使用情况 - 迄今为止,我们的下载量已超过 350 万次.这不包括在 Windows Server 2008 中使用它的人,因为它是作为可选组件包含的,不需要下载.

With regard to usage - we've had > 3.5 million downloads to date. That does not include the people using it in Windows Server 2008, because it is included as an optional component and does not need a download.

V2 将在所有版本的 Windows 中提供.除了作为可选组件的服务器核心之外,所有版本都将默认启用.在 Windows 7/Windows Server 2008 R2 发布后不久,我们将在所有平台(Windows XP 及更高版本)上提供 V2.换句话说 - 您在学习上的投资将适用于非常多的机器/环境.

V2 will ship in all versions of Windows. It will be on-by-default for all editions except Server core where it is an optional component. Shortly after Windows 7/Windows Server 2008 R2 ships, we'll make V2 available on all platforms, Windows XP and above. In other words - your investment in learning will be applicable to a very large number of machines/environments.

最后一条评论.如果/当您开始学习 PowerShell,我想您会很高兴.大部分设计都深受我们的 Unix 背景影响,因此虽然我们完全不同,但您会很快上手(在您不再咒骂它不是 Unix 之后 :-)).

One last comment. If/when you start to learn PowerShell, I think you'll be pretty happy. Much of the design is heavily influenced by our Unix backgrounds, so while we are quite different, you'll pick it up very quickly (after you get over cussing that it isn't Unix :-) ).

我们知道人们的学习预算非常有限 - 这就是为什么我们非常注重一致性.你会学到一些东西,然后你会一遍又一遍地使用它.

We know that people have a very limited budget for learning - that is why we are super hard-core about consistency. You are going to learn something, and then you'll use it over and over and over again.

实验!享受!参与!

这篇关于PowerShell 准备好替换 Windows 上的 Cygwin shell 了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆