Tuesday, 13 August 2013

Unix pipe into ls

Unix pipe into ls

I thought I understood *nix pipes until now... I have an executable called
studio which symlinks to my install of Android Studio and I had assumed I
could get the linked-to location with
which studio | ls -l
But that doesn't work. What it gives me is equivalent to having just run
ls -l in the current directory.
If I run which studio, I get /home/me/bin/studio. And if I run ls -l
/home/me/bin/studio I get the expected output showing me the symlink
location.
So why doesn't the piped version work? What haven't I grokked about pipes?

No comments:

Post a Comment