Emmm Windows 装了 busybox 或者 coreutils,cat 和 echo 的效果确实不一样。 --- > echo 2333 | echo 2333 > echo 2333 | cat cat : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input. At line:1 char:13 + echo 2333 | cat + ~~~ + CategoryInfo : InvalidArgument: (2333:PSObject) [Get-Content], ParameterBindingExcep tion + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.GetContentCommand
@oIMOo 因为你调用的不是 cat,而是 PowerShell 函数 Get-Content 的 alias 你调用的 echo 也是 Write-Output 的 alias 输入 gal 或 Get-Alias 可以看到这些内置的 alias,微软为了用户体验接近*nix 风格也是煞费苦心,就是有点不伦不类。 要调用实际的程序的话需要在名称后面加.exe
minmini
2020-01-28 22:59:24 +08:00
$ echo 2333 | cat 2333 $ echo 2333 | echo
$ mac 是这样的呢
yexiaoxing
2020-01-28 23:14:39 +08:00
The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command-line order. If file is a single dash (`-') or absent, cat reads from the standard input.
The echo utility writes any specified operands, separated by single blank (` ') characters and followed by a newline (`\n') character, to the standard output.