Append string in pipe
Or how to echo stdin
Let's say you want to output the time but also append a string to it.
This will append a string to your pipe / stdin and then output:
date | echo $(cat) "extra words go here"
Or to prepend a string:
date | (echo -n "extra words go here" && cat)
The dash n removes the trailing newline that echo automatically inserts.
This will append a string to your pipe / stdin and then output:
date | echo $(cat) "extra words go here"
Or to prepend a string:
date | (echo -n "extra words go here" && cat)
The dash n removes the trailing newline that echo automatically inserts.