tech-userlevel archive

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

Re: bin/44246: enhance mv to work better with xargs



David Laight <david%l8s.co.uk@localhost> writes:

> On Sun, Jan 13, 2013 at 08:47:53PM +0400, Aleksej Saushev wrote:
>> mlelstv%serpens.de@localhost (Michael van Elst) writes:
>> > mouse%Rodents-Montreal.ORG@localhost (Mouse) writes:
> ...
>> > And with a standard POSIX xargs it is:
>> >
>> > ls -1 | xargs -I X mv X newdir
>> 
>> Except that it doesn't work in modern world where you can easily find
>> files with whitespace (and apostrophes!) in name.
>
> There shouldn't be any problems with 'odd' filename characters,

lithium$ echo "'" | xargs echo
xargs: unterminated quote
lithium$ echo $?
1
lithium$ echo "'" | xargs -I X echo X this
xargs: unterminated quote

> but
> the -I will execute the command for every input line (aka filename).
> Which isn't really the point of involving xargs.

I'd say there're multiple reasons for not using xargs at all.


-- 
HE CE3OH...



Home | Main Index | Thread Index | Old Index