Bash – How to cat a file I got from stdin without xargs

bashcatpipeshellxargs

In an effort to learn the shell better, and without always having to resort to xargs, I have been trying to discover any other ways to do:

find . -name *.tcl | xargs -I{} cat {}

xargs make it feel messy and I would like to know if there are multiple way to accomplish this.

EDIT:
I did discover that another solution is to use:

find . -name "*.tcl" | cat `cat /dev/stdin`

I don't understand why I have to cat a filename before cat will see it as a file instead of a string though….

Best Answer

You could also use find in a sub process and feed the output to cat :)

cat $(find . -name "*.tcl")
Related Question