> On 10:00 02 Mar 2002, Andrew Smith <[EMAIL PROTECTED]> wrote:
> | > However, this can all be reduced even further:
> | >   find /home2/Temp/Test -type f \
> [...]
> | >           \) -print -exec rm -f {} ';'
> | 
> | make the last line:
> |             \) -print -exec rm -f '{}' ';'
> | 
> | If you don't do this the script WILL DELETE any files
> | that match the beginning of a filename you want deleted
> | but that contains a space in it (since the choice was "rm -f")
> 
> NO.
> 
> You are TOTALLY wrong here. You have obviously never tested this.
> 
> The arguments to -exec ARE NOT handed to the shell for interpretation
> and subsequent dispatch, they are passed directly to execv, and ARE NOT
> suject to space interpretation at all, nor any other kind of quoting
> issue.

<RANT removed>

> Cameron Simpson, DoD#743        [EMAIL PROTECTED]   

Yes you are right (doesn't take 30 lines to say that though)

Yes I have tested this ... it didn't work ... but the cause was
something else further down the chain - and - I added quotes AND changed
something else to fix the problem without realising the problem was
not 'find' but another shell script (that was fixed) that got exec'd.

So, you determined the cause of an old bug I had a few years ago :-)
Thanks.

Now ... to remove all those quotes around {} in all my scripts ... :-)

My incorrect assumption was that the 'find' exec code was doing
something stupid to determine arguments for exec (rather than just
using argv) and I stay clear of reading code unless I have to coz
most code is not written with any thought for anyone else reading it

I have no difficulty understanding shell scripts
- except when they are written by dopes who believe that structured
coding is a waste of time when writing large scripts
- or better still are unable to break down a large script into
smaller fundamental functions and break it up into smaller scripts
- or people who think there is something good about cryptic/hard to
read scripts

-- 
-Cheers
-Andrew

MS ... if only he hadn't been hang gliding!



_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to