> From time to time I toy with the idea of implementing a > fully correct xargs (the Unix one doesn't quote arguments). if you're guaranteed not to have spaces or newlines in filenames, then it doesn't matter. i have a small C xargs (attached) that is probably still correct. (i think newlines are probably still banned in filenames). > I wonder if structural r.e.s can express a > complete and correct quoting algorithm. well a normal r.e. can express the rc quoting algorithm. the problem you can't just match it, you've got to translate it as well. (([^ \t']+)|'([^']|\n|'')*') the inferno shell provides primitives for quoting and unquoting lists, which are useful at times. (e.g. variables in /env are stored in quoted form rather than '\0' terminated). > what we really need is a convenient way to feed macros to > sam in a sed-like manner and somebody with the time and > inclination to develop suitable macros and package it all up. to be honest there's very little that beats the convenience of: rm `{ls | grep -v precious} (which is now broken). while i'm mentioning the inferno shell, nemo's example works nicely, as you can pass shell fragments around as words. e.g. walk /source {if {ftest -r $1} {echo $1}} which lets the shell parse the argument command before passing it on to the walk script: #!/dis/sh if {! ~ $#* 2} { echo 'usage: walk file cmd' >[1=2] exit usage } (file cmd)=$* du -a $file | getlines { (nil f) := ${split ' ' $line} $cmd $f } if du produced a quoted word for the filename, (nil f) := ${split ' ' $line} would just change to: (nil f) := ${unquote ' ' $line} it's quite nice being able to do this sort of thing, but there are tradeoffs, naturally. cheers, rog.