Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: using pipes in a system() call

by bluto (Curate)
on Dec 07, 2005 at 20:41 UTC ( #515031=note: print w/replies, xml ) Need Help??


in reply to using pipes in a system() call

Be very careful about using find in this manner. If you know that file paths are always well formed, this is ok. I highly suggest you look into using the -print0 option of find and the corresponding '-0' (minus zero) of xargs, which most modern versions support. Update: Well most *should* support it but one of the boxes I used didn't appear to so perhaps thats a GNU-ism?

The main problem is when a user starts naming files with strange characters (esp spaces) in them these are not usually interpreted properly by xargs, even if you are only passing 1 argument via xargs' -n option. For example if a user has created a file named 'foo', a directory named 'foo ', a directory located under 'foo ' named 'etc', you will not be happy with the results of your chown (i.e. /etc will end up being chowned).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515031]
help
Chatterbox?
LanX .oO(positively thought)
[holli]: :) No. I might be small, but you don't want to be around me when I flip.
[LanX]: I can imagine ...
LanX hurts to be bitten between the legs ;-)
[holli]: You see, I have a friend whose daughter has been damaged seriously because she wasn't vaccinated against measles. (Her mother being anti-vaxx).
[LanX]: Contrary to Olivia newton John I don't like physical confrontations ...
[LanX]: Oh, you spread measles in your saliva?
[LanX]: ... and why did you bite hos daughter?
[LanX]: *his
[holli]: And this guy was also Anti-Vaxx and I just snapped. I shoed him all over the yard

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-12-13 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (373 votes). Check out past polls.

    Notices?