On Fri, Apr 22, 2005 at 01:57:59PM -0700, Linda A. W. wrote:

> The only thing I would have as a problem in "$@" is if I had double
> quotes in a file name somewhere.

That should work too for shell scripts, but the problem is that
"xargs" doesn't cope with it (because the quote processing follows the
POSIX specification):-

[EMAIL PROTECTED]:~/source/misc/tmp$ cat show-quoted.sh #! /bin/sh
i=0
for arg; do echo $((i++)) "[$arg]"; done
echo ALL: "$@"
[EMAIL PROTECTED]:~/source/misc/tmp$ sh show-quoted.sh  a "'b" "  d    " Ee ' 
"F"" '
0 [a]
1 ['b]
2 [  d    ]
3 [Ee]
4 [ "F""  ]
ALL: a 'b   d     Ee  "F""
[EMAIL PROTECTED]:~/source/misc/tmp$ echo  a "'b" "  d    " Ee ' "F""  ' | 
xargs echo
xargs: unmatched single quote; by default quotes are special to xargs unless 
you use the -0 option

> So then -print0/-0 seem to be the best options for passing
> filenames...

Yes, that's certainly true.

James.


_______________________________________________
Bug-findutils mailing list
Bug-findutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-findutils

Reply via email to