Skip to main content
Tweeted twitter.com/super_user/status/1309689176921706496
deleted 1 characters in body
Source Link
Mihai Rotaru
  • 2.9k
  • 5
  • 28
  • 25

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ).

What isI do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ).

What is do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ).

What I do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?

added 42 characters in body; edited title
Source Link
Mihai Rotaru
  • 2.9k
  • 5
  • 28
  • 25

how How to pipe command output to other commands  ?

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ).

What is do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?

how to pipe command output to other commands  ?

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected.

What is do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?

How to pipe command output to other commands?

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ).

What is do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?

Source Link
Mihai Rotaru
  • 2.9k
  • 5
  • 28
  • 25

how to pipe command output to other commands ?

Example:

ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files.

ls | grep 'foo', on the other hand, works as expected.

What is do in these situations is something like: ls | while read OUT; do echo $OUT; done but this is rather cumbersome.

Why does piping work with some commands, but not with others ? How can I circumvent this issue ?