Reputation: 7411
I can't figure out how to make the following work without using cat. I'm not worried about the forked process or anything, it just unsettles me:
$ printf "<format specification string>" $(cat source-file.txt)
Is there a better way?
Upvotes: 3
Views: 632
Reputation: 11090
Even though it is useless use of cat, I would still use cat
for outputting contents of a file instead of <
in this case because it eliminates the possibility of overwriting the input file due to a redirect character typo (>
)
Upvotes: 0
Reputation: 48290
Yes. You can accomplish the same thing, without creating a new process for cat
, with:
$ printf "<format specification string>" $(<source-file.txt)
Upvotes: 7