coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] [PATCH] md5sum: Add option to ignore non-existant files


From: Luther
Subject: Re: [coreutils] [PATCH] md5sum: Add option to ignore non-existant files
Date: Fri, 10 Dec 2010 22:29:49 -0500

I can't find a way in Ruby to control the standard input to a shell
command. Unless I want to maintain a fork or rewrite the program, I'll
have to settle for Pádraig's idea. I've put the following into
my .bash_aliases:

function chsum {
  md5sum -c $1 2> /dev/null | 'grep' -E '(OK|FAILED)$'
}

Luther

On Fri, 2010-12-10 at 00:38 +0000, Pádraig Brady wrote:
> On 09/12/10 03:14, Luther wrote:
> > Normally, when I use md5sum, it's when I download a file and an MD5SUMS
> > file that comes with it. This MD5SUMS file usually lists many files
> > including the one I downloaded. When I run 'md5sum -c MD5SUMS', I get
> > many error messages about files that I don't have. Obviously, I don't
> > care about the files I didn't download, and the error messages make it
> > difficult to see the output relating to the file that I do care about.
> > 
> > I suggest a new option, -i/--ignore-missing, which ignores any filenames
> > that do not exist on the filesystem.
> > 
> > In my patch, the option simply suppresses both relevant error messages.
> > Another approach might be to have digest_check check to see if the file
> > exists. If it doesn't, don't call digest_file or print the 'FAILED'
> > message.
> > 
> > Sorry if my patch is a little messy, being in 3 parts. I'm not used to
> > using git.
> > 
> > HTH, and let me know what you think...
> > Luther
> 
> Thanks for the patch,
> and sorry for the mailing list delay
> (I'm not sure what moderation is done on these lists)
> 
> So you would like to filter out the warnings.
> Well they go to stderr, so you could just:
> 
>   md5sum -c file.sum 2>/dev/null
> 
> If you wanted to filter further to just FAILED you could:
> 
>   md5sum -c file.sum 2>/dev/null | grep FAILED$
> 
> It has the disadvantage of being longer to type
> but the advantage of using existing tools and
> options to do the filtering.  So at first glance
> this option doesn't seem needed.
> 
> cheers,
> Pádraig.

-- 
Please do not send me Microsoft Office/Apple iWork documents. Send
OpenDocument instead! http://fsf.org/campaigns/opendocument/




reply via email to

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