DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th April 2009
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Thanked 0 Times in 0 Posts
Default shell script compare md5 sum

I wrote a script to compare 2 same file but in different dir and filename. The md5 sum of both file is the same but how do i assign the output of md5 sum to a variable like $a and $b? Here's my code
Code:
a=$(md5 /home/abc/sss.sh)
b=$(md5 /home/abc/43/sss.sh)

if [ "$a" = "$b" ]
then 
         echo " match"
else
         echo " no match"
fi
I don't know how to assign the output to a variable.. pls help.
Reply With Quote
  #2   (View Single Post)  
Old 11th April 2009
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Thanked 0 Times in 0 Posts
Default

I got it. I look at the md5 man page and use -q quiet option to print only the checksum.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script with zenity bsdnewbie999 OpenBSD General 5 24th April 2009 02:37 AM
shell script-start another process bsdnewbie999 Programming 2 23rd April 2009 07:48 PM
incrementing within a shell script? spiderpig Programming 5 29th September 2008 08:12 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM
shell script with input c0mrade Programming 5 13th July 2008 04:33 AM


All times are GMT. The time now is 02:59 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick