On Thu 11 Mar 2021 at 16:09:40 (+1100), David wrote: > On Thu, 11 Mar 2021 at 14:52, David Wright <deb...@lionunicorn.co.uk> wrote: > > On Wed 10 Mar 2021 at 17:45:48 (-0500), Stefan Monnier wrote: > > > > dpkg -S =foo > > > Sorry, but we're not all familiar with the construct "=foo" > > as interpreted by zsh, oops, Zsh. Can you elaborate on what > > dpkg itself is being fed by this command line. I searched > > man dpkg and man dpkg-query for = but that didn't help. > > It appears to be a Zsh feature, nothing to do with dpkg. > During procrastination, I found this [1]: > ''' > The companion of `~' is `=', which again has to occur at the start > of a word or assignment to be special. The remainder of the word > (here the entire remainder, because directory paths aren't useful) > is taken as the name of an external command, and the word is > expanded to the complete path to that command, using $PATH > just as if the command were to be executed: > > % print =ls > /bin/ls > ''' > [1] http://zsh.sourceforge.net/Guide/zshguide03.html#l58 > > So the above dpkg command seems to be the equivalent of > dpkg -S $(type -p foo) > in Bash.
Thanks. So really the complaint is just that dpkg -S operates on the paths of files as packaged, whereas type -p yields canonical paths, I assume. Interactively, I guess that's another reason I hadn't thought of for piping dpkg -S unadornedname | less or using apt-file find likewise piped. As for scripts (other than personal ones), would people write them to rely on this feature? Cheers, David.