Can someone explain why the two commands below give different results?
The first pipes the output of
who to grep, the second takes the output of
who as a redirection.
~: who |grep $(tty|cut -c 6-) my_username tty1 2016-01-22 09:56 (:0) ~: grep $(tty|cut -c 6-) <(who) my_username pts/5 2016-01-22 11:35 (:0.0)
color=always as an option to grep in both cases gives the first as matching on
tty. The second one matches on
pts/5 as expected.
tty | cut -c 6- command gives me (in this instance) the
pts/5 part of
I've tried using quotes (both
") around various parts but with no success.
I realise now that the
who -m command gives the line I was after but the question of why the lines above are different still stands.