Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14
Like Tree2Likes
md5sum -c <File> will parse <File> for filenames and checksums. It will then build new checksums of all the parsed filenames and compare against the parsed checksums. If the checksums ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,356

    md5sum -c <File> will parse <File> for filenames and checksums.
    It will then build new checksums of all the parsed filenames and compare against the parsed checksums.

    If the checksums are equal, the return code is zero.

    The if statement checks for the negated return code.

    Hence: The body of the if statement is executed if md5sum returns with a non-zero.
    elija likes this.
    You must always face the curtain with a bow.

  2. #12
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,482
    As I said in my prior post, the trick is in this line
    Code:
    ! md5sum -c $DATA_CHECKSUMFILE
    check out the md5sum help or man page for the -c flag

    [edit]Beaten to it and with a better description to![/edit]
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  3. #13
    Just Joined!
    Join Date
    Mar 2013
    Posts
    6
    Quote Originally Posted by Irithori View Post
    md5sum -c <File> will parse <File> for filenames and checksums.
    It will then build new checksums of all the parsed filenames and compare against the parsed checksums.

    If the checksums are equal, the return code is zero.

    The if statement checks for the negated return code.

    Hence: The body of the if statement is executed if md5sum returns with a non-zero.
    It's pretty much clear now,Thanks for your time and reply.

    Thanks all for your support!!

  4. #14
    Just Joined!
    Join Date
    Mar 2013
    Posts
    6
    The code works fine for one run(we are overwriting md5 everytime) but what if the same file comes after two or three runs,how to handle such situations using same logic?

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •