I’ve seen the technique before, but don’t know what it’s called and forget the exact syntax. Let’s say I need to pipe in a file to a program like: command < input-file. However, I want to directly pass these lines of the input file into the command without the intermediate input file. It looks something like this, but it doesn’t work:
command < $(file-line1; file-line2; file-line3)
Can someone tell me what this is called and how to do it?
This is called
Process SubstitutionWith the above,
commandwill think its being input a file with a name much like/dev/fd/XXwhere ‘XX’ is some number. As you mentioned, this is a temporary file (actually a file descriptor) but it will contain the 3 lines you passed in to theprintfcommand.