coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH]: add an option for quiet copy operations


From: Guido Trentalancia
Subject: Re: [PATCH]: add an option for quiet copy operations
Date: Thu, 16 Feb 2012 17:59:36 +0100

Hello Pádraig.

On Thu, 2012-02-16 at 14:20 +0000, Pádraig Brady wrote:
> On 02/16/2012 02:01 PM, Pádraig Brady wrote:
> > On 02/16/2012 07:21 AM, Guido Trentalancia wrote:
> >> Hello.
> >>
> >> I am writing to propose a simple patch for review. The patch adds an
> >> option "-q" or "--quiet" to cp, mv and install so that they can support
> >> quiet operation on missing SOURCE files.

[cut]

> > Thanks a lot for taking time to do the patch.
> > I'm not sure about it though.
> > You could easily use other tools to filter non existent arguments.
> > Something like:
> > 
> >   find file1 file2 -print0 2>/dev/null |
> >   xargs -r0 cp --target=dest/
> > 
> > Or alternatively something like:
> > 
> >   cp $(realpath -e file1 file2 2>/dev/null) dest/

It's not very concise and it might not be straightforward to remember...

> > cheers,
> > Pádraig.
> > 
> > p.s. Hmm, I wonder should `realpath -e` suppress ENOENT.
> > readlink -e does
> 
> Ah now I remember.

You see, it's definitely not straightforward to remember, as it took
about 19 minutes for you since the first message appeared on the list.

> readlink is --quiet by default (so the --quiet and --silent
> options are largely redundant)
> 
> realpath diagnoses ENOENT etc. by default, unless --quiet is specified.
> So a better form of the above command is:
> 
>   cp $(realpath -qe file1 file2) dest/
> 
> A caveat of the above, is that it doesn't handle spaces in filenames.
> To do that you'd have to use something of the original form, like:
> 
>   realpath -zqe "file 1" "file2" |
>   xargs -r0 cp --target=dest/

How about "cp file1 file2 > /dev/null 2>&1" ???

> cheers,
> Pádraig.

Regards,

Guido




reply via email to

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