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 and shell scripting languages 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 04:16 AM
need help in diff command : ali560045 Shell Programming and Scripting 5 05-26-2008 10:22 AM
diff command Vichu Shell Programming and Scripting 1 04-28-2008 08:06 AM
diff command gilead29 UNIX for Dummies Questions & Answers 7 03-09-2004 09:12 PM
shell scripting my own diff command axcxe UNIX for Dummies Questions & Answers 4 12-11-2003 02:20 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-25-2008
tlfletcher05 tlfletcher05 is offline
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..
  #2 (permalink)  
Old 01-25-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
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'
  #3 (permalink)  
Old 01-26-2008
zouhair zouhair is offline
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0