A pipeline cmd1 | cmd2
by definition connects the standard output file descriptor of cmd1
as the standard input file descriptor of cmd2
.
echo foo | file -
This particular example is hardly useful; the file
command doesn't make a lot of sense to run on the kind of ephemeral data you have inside a pipeline. A more useful example runs file
on, well, a file. If you absolutely want the file to be standard input, a simple input redirection does that.
file - </path/to/example/file
Or you might be looking for this:
file $(locate example/file)
where locate
is an example of a command which prints the full path to a file you might want as the actual input argument to file
.