0

I would like to use the result of which ls and see the file type using file. However, when I type in which ls | file it doesn't work. When I try to do file < which ls, that doesn't work either.

Any pointers would be appreciated.

Grateful
  • 113

1 Answers1

2

This does not work because file takes the file to examine as commandline parameter (see man file).

You are piping the output of which to the stdin of the process executing ls.

What you should do is something like file "$(which ls)".

Stephen Kitt
  • 434,908
gerhard d.
  • 2,188