Why this is working
gdbus monitor -y -d org.freedesktop.login1 | grep org
Filtering output lines containing "org"
This is working
gdbus monitor -y -d org.freedesktop.login1 | (while read LINE ; do echo "$(date) $LINE" ; done)
Printing date before line output
But this is not working.
gdbus monitor -y -d org.freedesktop.login1 | grep org | (while read LINE ; do echo "$(date) $LINE" ; done)
The intention here is to print out date before line output only for lines containing "org"
grep --line-buffered
- see for example What does grep line buffering do? and Read logs real time with bash – steeldriver Oct 15 '22 at 19:17pidof gdbus
– ubfan1 Oct 15 '22 at 21:02