[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xargs feature request...

From: James Youngman
Subject: Re: xargs feature request...
Date: Mon, 25 Apr 2005 15:01:13 +0100
User-agent: Mutt/1.3.28i

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):-

address@hidden:~/source/misc/tmp$ cat show-quoted.sh #! /bin/sh
for arg; do echo $((i++)) "[$arg]"; done
echo ALL: "$@"
address@hidden:~/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""
address@hidden:~/source/misc/tmp$ echo  a "'b" "  d    " Ee ' "F""  ' | xargs 
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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]