Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zargs doesn't work reliably



On 8/18/06, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Aug 17,  8:17pm, Mikael Magnusson wrote:
}
} > There are approximately eleventeen zillion unix/linux commands that
} > break given those file names, including rm, ls, and cp, so I'm not
} > going to get particularly worked up about zargs behaving similarly.
}
} % ls -l -- *

Yes, and you used an explicit "--" to tell ls that there might be "--"
in its argument list; it would have failed if you did not.  The same
goes for "zargs -e".

} Would this be possible?
} zargs '[options]' 'command [initial-args]' [input-args]

I'm not going to agree with you about any scheme that breaks congruence
with the way xargs accepts its command and initial-args.  The whole point
of zargs is to mimic xargs as closely as possible.

} Sorry, I should have looked in the manual. In my defense zargs --help
} was so helpful that i didn't suspect it left anything useful out and i
} did say i was tired :). Thanks for the pointers.

Thanks for the compliment about the help.  It does say fairly early:

Options:
--eof[=eof-str], -e[eof-str]
    Change the end-of-input-args string from "--" to eof-str.  If
    given as --eof=, an empty argument is the end; as --eof or -e,
    with no (or an empty) eof-str, all arguments are input-args.

After reading this a couple of times and trying some different
commands i came up with this working command:
% zargs --eof= -- * '' ls -d --
--  -+

On Aug 18,  6:12am, Mikael Magnusson wrote:
}
} > What if you need an initial-arg that contains a space?
}
} I don't quite understand the question... zargs '' 'touch file\ with\
} spaces' /tmp/*
} or zargs '' 'touch "file with spaces"' /tmp/*

What if you have one initial-arg with a space, one with a backslash, one
with a single quote, and one with a double-quote?

The input-args already come to you "quoted" via the globbing mechansim.
It's much easier to pick something (including empty string, see the help
snippet above) that won't appear in the input-args than it is to quote
your way around oddities in the initial-args.

I didn't mean to sound like the current way is wrong and i have all
the answers, although it might have sounded a bit like that; i just
meant to make suggestions or ask if things would work that way.
Thanks again for your helpful help, and in the meantime i have another
question :). (->new thread)

--
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author