in reply to The question hpunixguy2 was too scared to ask - How does he quote shell meta characters

In order to pass a list of foobar file names to a shell command, I think the best approach does not involve perl at all (at least, not for unix/linux users, or people with proper unix-tool environments on their windows pcs):
find path -type f -print0 | xargs -0 some_command -opts
For example, I just tried this, and it worked fine:
$ cd /tmp $ mkdir test $ cd test $ echo '12$34 12|34 12!34 12&34' | xargs touch # check that this really worked: $ find . -type f ./12!34 ./12$34 ./12&34 ./12|34 # now clean up the mess: $ find . -type f -print0 | xargs -0 rm # check that this really worked: $ find . -type f
Apparently, using xargs on a shell command has the same effect as using the system() or exec() call in perl with arrays of args.
  • Comment on Re: The question hpunixguy2 was too scared to ask - How does he quote shell meta characters
  • Select or Download Code