Sponsored Content
Full Discussion: Compare two md5sum
Top Forums Shell Programming and Scripting Compare two md5sum Post 302981049 by toscan on Tuesday 6th of September 2016 10:47:03 PM
Old 09-06-2016
Hello Don Cragun !

Thanks to show me the right way to insert code in my post and thanks for the reply,

Now with your help I don't have errors in the script but the result is wrong.

I check the two checksums are the same and the sh script give it changes.

I cannot give the url now because I need 5 posts but i can send you a capture.

Image

---------- Post updated at 11:30 AM ---------- Previous update was at 11:24 AM ----------

OK I found my error

---------- Post updated at 11:31 AM ---------- Previous update was at 11:30 AM ----------

there is a " -"
after the second checksum the just verified now one.

---------- Post updated at 11:33 AM ---------- Previous update was at 11:31 AM ----------

I added th space and the "-" but I now have an error

Code:
~# sh verif2.sh 
verif2.sh: 3: verif2.sh: -: not found

I'm trying different with quotes etc.

---------- Post updated at 11:37 AM ---------- Previous update was at 11:33 AM ----------

Hello again, now i don't understand because it still give the "change" result and I checked with an echo to see the two different results and they are the same !

Code:
 if [ "$last_checksum" = "$checksum" ]
then
    echo "rien"
else
    echo "change"
fi

echo $last_checksum
echo  $checksum

it gives :

Code:
sh verif2.sh 
change
52f8422918c5347166dbb40c76f95e9c -
52f8422918c5347166dbb40c76f95e9c -

we see it's the same it say "change" is there a reason for this ?

---------- Post updated at 11:47 AM ---------- Previous update was at 11:37 AM ----------

Sorry again, I find out !

with the quotes, the new checksum echo result is different thant without the quotes : one more space " -"
If i delete the quote at the first declaration of the checksum valeur its give an operator error, so i add one more space in my last checksum and it works ! !

Thank you so much for your super clear explanations !

I'm now trying to insert it in a cron and send me an email if it changes, the vps where I run this script already works for sending emails because my logwatch emails are finely received.

thank you again.

when I was a kid computers were my hobby and when I can afford it and when my usage of computers fit some of my needs I'm happy to do it myself. But I can confess actually I m jobless in japan and need money so this time I'm not defendable to spend so much time in this hobby...

I really apreciate your help !

Thank you.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What is md5sum???

Hi all, I am kinda puzzled. When and Why do we use md5sum? I've read man pages for mp5sum, but didn't get anything out of it. Please, can someone explain this to me in couple of words. Thank you all. (1 Reply)
Discussion started by: solvman
1 Replies

2. UNIX for Dummies Questions & Answers

the file: MD5SUM

i downloaded a Linux distribution from a FTP site today, and i found there is a file named MD5SUM in the same directory, with the following contents: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 c9a4d963a49e384e10dec9c2bd49ad73 valhalla-SRPMS-disc1.iso 41b03d068e84d2a17147aa27e704f79b ... (1 Reply)
Discussion started by: samprax
1 Replies

3. Programming

md5sum and execve

Hello there! Is there a way to use execve() to run md5sum function? for example execve("md5sum <filename>, NULL,NULL);" thanx! (2 Replies)
Discussion started by: nicos
2 Replies

4. Programming

Computing an MD5Sum in C

Is it possible to call the unix command md5sum from within a C program. I am trying to write a C program that scans a directory and computes the MD5Sum of all the files in the directory. Whenever I use md5sum 'filename' I get the error 'md5sum undeclared'. Is there a header file or some library... (3 Replies)
Discussion started by: snag49ers
3 Replies

5. Shell Programming and Scripting

md5sum in different linux

something strange is that i find the md5sum command in different linux generate different result, for example, i have tried the same file in CentOS and Rhel, The md5 results are different, it is quite headache, who know the tricks? (3 Replies)
Discussion started by: zbc
3 Replies

6. Shell Programming and Scripting

Md5sum script

Hello, I need to download multiple files from an FTP server but occasionally they arrive in error so I need to perform an integrity check. I've been attempting to write a bash script that does the following: Downloads all files including those in sub directories Perform md5sum using... (4 Replies)
Discussion started by: shadyuk
4 Replies

7. Shell Programming and Scripting

Compare files in directories with md5sum

And not to start. I can compare files, that's easy. The problem is that I compare files in a directory, and check if these files exist in another directory. The problem is that the file names are not the same. So I have to compare with "md5sum" or something similar. How I can do? All this in... (7 Replies)
Discussion started by: Jomeaide
7 Replies

8. Shell Programming and Scripting

Compare md5sum two servers' setup

I'm trying to think of a way to compare two boxes and make sure their files will be the same. There may be extra files on one side and some on the other. I also need to make sure the file content is identical. So far I've gotten this to create a file find /directorypath/ -type f -name... (3 Replies)
Discussion started by: xgringo
3 Replies

9. UNIX for Beginners Questions & Answers

Expect in Bash - and then compare md5sum

I'm running on a staging server. I will need to use expect and I think ssh or scp to the other boxes. I need to see something like this....Enter:Host 1 Enter:Host 2 Enter full directory path to compare: example /apps/acd/jboss-customer1/ Enter User Id: Enter Password: ( Assumes... (6 Replies)
Discussion started by: xgringo
6 Replies

10. Shell Programming and Scripting

[md5sum] script

I am getting No such file or directory if my variable contains white spaces... Is there a way to fix this? This works x="1.md5" md5sum -c "$x" This, does not x="23\ 5\ 6\ 7\ 8\ 9\ 10.md5" md5sum -c "$x" md5sum: '23\ 5\ 6\ 7\ 8\ 9\ 10.md5': No such file or directory How do I fix... (1 Reply)
Discussion started by: soichiro
1 Replies
time-admin(1)						      General Commands Manual						     time-admin(1)

NAME
time-admin - Time Administration Tool SYNOPSIS
time-admin [OPTION...] DESCRIPTION
time-admin is part of the GNOME system tools, a set of tools to easily access and manage system configuration. time-admin allows you to set the time, date and timezone of your system, as well as setting any time server to synchronize your local time server. OPTIONS
time-admin accepts the standard GNOME and GTK options. AUTHORS
time-admin was written by Carlos Garnacho Parro <garnacho@tuxerver.net> and others. This manual page was written by Sven Arvidsson <sa@whiz.se>, for the Debian project (but may be used by others). SEE ALSO
services-admin(1), shares-admin(1), network-admin(1), users-admin(1), gtk-options(7), gnome-options(7) The online documentation available through the program's Help menu. GNOME
2007-05-08 time-admin(1)
All times are GMT -4. The time now is 03:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy