![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#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.. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |