1

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.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Zach
  • 115
  • 3

1 Answers1

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