0

i typed the following command

which cp | ls -l

It didn’t work as i expected. I wanted that the output of the which command will be a path name. So the ls command will show the information about the path or that file. Although which cp | less works what is supposed to. But why don’t which cp | ls -l works as expected.

muru
  • 69,900
  • 13
  • 192
  • 292
play store
  • 121
  • 3
  • Possible duplicate of [Why can't certain programs (like readlink) take input from a pipe?](https://unix.stackexchange.com/questions/93334/why-cant-certain-programs-like-readlink-take-input-from-a-pipe) ... or more closely: [whereis, pipline and ls](https://unix.stackexchange.com/questions/364079/whereis-pipline-and-ls) – muru Dec 10 '19 at 06:35
  • use xargs then `which cp | xargs ls -l` – darxmurf Dec 10 '19 at 10:02

0 Answers0