On 2013-06-04 19:37, Jason White wrote:
> Andrew Spiers <[email protected]> wrote:
> > Is this the best way?
> > 
> >    dpkg -L python-docutils |  xargs ls -dF  | grep \*
> 
> Perhaps a variant of this?
> for fn in $(dpkg -L python-docutils) ; do [ -f $fn -a -x $fn ] && echo $fn ; 
> done
> 
> You could use the officially deprecated but ubiquitous `...` syntax rather
> than $(...) if you prefer.
> 
> Note that the -f test is needed to exclude directories.

Hi Jason,

That's a slightly different approach, and one that I don't think does as
much quoting as it should. If you can reasonably make assumptions about
(for example) the absense of spaces in filenames of deb packages, then
your approach will work, but mine is slightly more robust. I'd have
quoted every expansion of "$fn", and not used the $() because of the
space issue. The while loop (with data passed in via a pipe or fd) is
more robust here, but as mentioned, given the limitations of dpkg -L,
doesn't handle filenames containing newlines.

-- 
Regards,
Matthew Cengia

Attachment: signature.asc
Description: Digital signature

_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to