Assuming:
- the path of file f is ~/f
- "which f" shows "~/f",
Then,
which f | cat
shows ~/f
. So cat
here is applied to the quotation of ~/f
, which is different with cat ~/f
.
My question is: how I could use one command composed of which
and cat
to achieve the result of cat ~/f
? When I don't know the result of which f
in advance, using this composition can be very convenient. Currently, if I don't know the result of which f
in advance, I have to invoke which f
first, and copy-paste the result to feed less
.
A related question is: how can I assign the result of which f
to a variable?
Thanks a lot!