Why does echo foo | wall work but cat | wall not work? In the latter case, I enter a couple lines into cat, and in theory they should pipe to wall; however, nothing happens.
Asked
Active
Viewed 767 times
1 Answers
0
wall doesn't send each line of its input as a separate message. It collects the entire input so that it can send a single Broadcast Message from ... heading before the message, rather than sending a separate heading for each line.
If you want to process the input a line at a time, you can insert a loop between cat and wall:
cat |while read -r line; do wall <<<"$line"; done
Barmar
- 9,648
- 1
- 19
- 28
-
1`cat` not needed here. – Kusalananda Feb 10 '18 at 21:22
-
@Kusalananda Just trying to match the question. I assume that the real application will be piping something else and this is a placeholder. – Barmar Feb 10 '18 at 21:24