The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
diff command ariec AIX 3 06-05-2008 12:16 AM
need help in diff command : ali560045 Shell Programming and Scripting 5 05-26-2008 06:22 AM
diff command Vichu Shell Programming and Scripting 1 04-28-2008 04:06 AM
diff command gilead29 UNIX for Dummies Questions & Answers 7 03-09-2004 06:12 PM
shell scripting my own diff command axcxe UNIX for Dummies Questions & Answers 4 12-10-2003 11:20 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-25-2008
Registered User
 

Join Date: Jan 2008
Posts: 1
Need help with Scripting diff command

Here is where I am at so far.....
-------------------------
#!/bin/bash
echo "Enter the output file name"
read output_file
echo "Enter the Orginal file Name"
read write_file
d= ' diff $write_file $output_file '
if $d = 1 ;then
echo "files are not identical"
else
echo "they areidential"
fi
-------------------

I am not sure what I am doing wrong, and I am new at this
so it could be something small..
Reply With Quote
Forum Sponsor
  #2  
Old 01-25-2008
joeyg's Avatar
Moderator
 

Join Date: Dec 2007
Location: Home of world champion Boston Celtics
Posts: 983
formatting the diff command in a script

Perhaps try

d=$(diff $write_file $output_file)

not sure about your d=1 logic ??
I think you want to see if d is blank or has something in it.
Perhaps the difference in files is a '1'
Reply With Quote
  #3  
Old 01-25-2008
Registered User
 

Join Date: Feb 2006
Posts: 12
Maybe you want only to get the "$?" result for that matter:

#!/bin/bash
echo "Enter the output file name"
read output_file
echo "Enter the Orginal file Name"
read write_file
diff $write_file $output_file > /dev/null
if [ $? = 0 ];then
echo "files are identical"
else
echo "they are not identical"
fi
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0