There is an alternative to using echo to pipe to stdin of another command, using the heretofore unknown-to-me '<<<' operator.
echo 'hello' | nl
is equivalent to
nl <<< 'hello'
I'm not sure that the latter is more useful. It looks more elegant if the stream of commands is long for them to be in a consistent left-to-right order, e.g.
echo 'hello' | nl | rev | tee /dev/stderr
looks a lot better to me than
nl <<< 'hello' | rev | tee /dev/stderr
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment