which package a file belongs to
matthew.flaschen at gatech.edu
Sun Jan 18 19:13:27 UTC 2009
Nils Kassube wrote:
>>> Sorry, I don't understand why it shouldn't work. Here both commands
>>> have the same output.
>> Nothing is being passed to the cut command, so first you get:
>> cut: -: Input/output error
>> then dpkg -l gets no other parameters so prints everything.
> Now its getting interesting :)
> While your explanation seems logical, the command did work on my machine.
Yeah, it works in dash and bash. Apparently, this is an inconsistency
in zsh, my favorite shell. :(
> $ echo hello | ls $(cut -f1)
> ls: cannot access hello: No such file or directory
That's weird. It seems wrong to me to parse it that way. However, both
bash and dash do do it that way. A simpler test case is:
echo hello | echo $(cat)
cat: -: Input/output error
bash and dash both give hello.
> Like I wrote above, I have tested my version also and here it works. Could
> it be that you don't use bash but some other shell?
I was very surprised that this made a difference. Even with zsh
emulating sh it acts the same. Unfortunately, I don't know enough to
say whether this is a bug or "implementation detail".
However, I would say regardless the explicit version I gave is better.
More information about the ubuntu-users