Re: How to execute more than one command with find -exec?

From: Hrvoje Spoljar (fcbyr_at_k.cos.ue)
Date: 11/25/04

  • Next message: Justin Jones: "Re: boot floppy to facilitate boot from IDE CDROM on classic Pentium"
    Date: Thu, 25 Nov 2004 02:09:59 +0000 (UTC)
    
    

    IANAL_VISTA <IANAL_Vista@hotmail.com> na grupi comp.os.linux pise:
    [cut]
    >> I tried
    >> find XXX -name "*.gif" -exec grep {} abc.txt || rm {} \;
    >> But it seems -exec don't take behind as a combination of two commands.
    >> Anybody can tell me how to execute more than one command with find -exec?
    >> Thanks
    >>
    >
    > Try creating a script that contains everything you want to do.
    >
    > P.S.
    > I know all about using "|" as the pipe operator.
    > What does "||" (double pipe) supposed to do?

    same like in c, in [ba]sh it's OR operator...

    though it seems misused in statement find XXX ...
    rm {} \; would be executed only when find XXX ... statement generated
    output on sterr

    few examples...
    ls /somedir || echo " somedir does not exist " 2>/dev/null
    or
    test -x /etc || echo "/etc does not exist"

    -- 
     ____ __  ___| |  ___   Data,I thought  .~.    hrvoje.spoljar@><.pbf.hr
    (_-< '_ \/ _ \ |_/ -_)  you were dead! / V \   irc # RoCkY 
    /__/ .__/\___/__/\___|  -No Sir, I    /(   )\  icq : 53000945   
       |_|                  rebooted:)      ^-^    http://spole.pbf.hr
    

  • Next message: Justin Jones: "Re: boot floppy to facilitate boot from IDE CDROM on classic Pentium"