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.
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.
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)".
man ls | head... Although, head would also be expecting command line arguments ?
– Grateful
Dec 19 '22 at 07:40
man head: With no FILE, or when FILE is -, read standard input.. This means, that head takes stdin if no FILE is given.
– gerhard d.
Dec 19 '22 at 07:55
type -a lsinstead. Which is not reliable to use for what you wanr – Valentin Bajrami Dec 19 '22 at 07:24file /usr/bin/ls... Except, I would like to to check forwhichat the same time, and then use the result withfile. – Grateful Dec 19 '22 at 07:29