In PowerShell I have tried:
alias | select-string Alias
This fails even though Alias
is clearly in the output. I know this is beca
Your problem is that alias emits a stream of AliasInfo objects, rather than a stream of strings. This does what I think you want.
alias | out-string -stream | select-string Alias
or as a function
function grep {
$input | out-string -stream | select-string $args
}
alias | grep Alias
When you don't handle things that are in the pipeline (like when you just ran 'alias'), the shell knows to use the ToString() method on each object (or use the output formats specified in the ETS info).