请告诉我CMD / PowerShell的同等学历的bash反勾的? [英] Whats the cmd/powershell equivalent of back tick on bash?

查看:134
本文介绍了请告诉我CMD / PowerShell的同等学历的bash反勾的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重定向命令的输出:

例如:

echo "Foo `./print_5_As.rb`"

将回声富AAAAA

would echo "Foo AAAAA"

推荐答案

PowerShell的语法基于POSIX语法KSH
(和有趣的的任何微软的语言
像CMD.EXE,VBScript或Visual Basic应用程序),
这么多的事情工作pretty大致相同猛砸。在
你的情况下,命令替换用做

The PowerShell syntax is based on the POSIX ksh syntax (and interestingly not on any of Microsoft's languages like CMD.EXE, VBScript or Visual Basic for Applications), so many things work pretty much the same as in Bash. In your case, command substitution is done with

echo "Foo $(./print_5_As.rb)"

在这两个PowerShell和猛砸。

in both PowerShell and Bash.

猛砸仍然支持古路(反引号),但
PowerShell中清理的语法和去除多余
结构,如两个不同的命令替换
语法。这将释放一个反引号的不同的
在PowerShell中使用:在POSIX KSH,反斜杠用作
转义字符,但是这将是的非常的痛苦中
PowerShell的,因为反斜线是传统的路径
成分分离器在Windows中。因此,PowerShell使用
(现在使用的)反引号转义。

Bash still supports the ancient way (backticks), but PowerShell cleaned up the syntax and removed redundant constructs such as the two different command substitution syntaxes. This frees up the backtick for a different use in PowerShell: in POSIX ksh, the backslash is used as escape character, but that would be very painful in PowerShell because the backslash is the traditional path component seperator in Windows. So, PowerShell uses the (now unused) backtick for escaping.

这篇关于请告诉我CMD / PowerShell的同等学历的bash反勾的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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