When I type:
Now I want to list all the files in this directory, so I type:
whereis boost | ls
But it only shows the files in the current working directory. Is there anyway to list all the files more quickly following the idea above (the way can be different but the idea is I want to quickly have a glimpse at a directory which I find with whereis, locate or something like that).
Here is Solutions:
ls doesn’t take its arguments from its standard input (which is how a pipe passes data into a process), but from its command line.
ls $(whereis boost)
will take the output of
whereis boost and use it as arguments for
ls, giving the result you’re after. This is known as command substitution.
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂