On Wed, Nov 28, 2007 at 10:16:45AM +1100, Amos Shapira wrote:
> On 28/11/2007, Alex Samad <[EMAIL PROTECTED]> wrote:
> > Hi
> >
> >
> > I have this commend which i use
> >
> > find -mindepth 2 -type d -exec bash -c 'ls -l "{}" | tail -n 2' \;
> >
> > I have tried to format the -exec option with out the bash -c, but I can't
> > figure out a way to escape off the |
>
> If you don't want bash to interpret the 'ls -l "{}" | tail -n 2' then
> which program is supposed to interpret the pipeline symbol?I wanted | to be interpreted by the exec command, silly me I just presumed it started a sh, but thinking about it know, it probably doesn't which is why it can't process the | I want to show the last 2 files in the directory > > > > > I could make a function out if it, but was wondering if there were any find > > experts who could shed light on it ? > > Such questions are served much better 99% of the time when the intent > of this whole exercise is given. > > It appears as if you are trying to get the ls output for the last two > files in each directory (sorted by name). Is this correct? What kind > of data do you want about them (i.e. do you need exactly an "ls -l" > format output)? What do you want to do with that information? > > --Amos > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html >
signature.asc
Description: Digital signature
-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
