Parsing result of Diff in Shell Script

Posted by Saobi on Stack Overflow See other posts from Stack Overflow or by Saobi
Published on 2010-04-19T22:15:57Z Indexed on 2010/04/19 23:13 UTC
Read the original article Hit count: 177

Filed under:
|
|
|

I want to compare two files and see if they are the same or not in my shell script, my way is:

diff_output=`diff ${dest_file} ${source_file}`

if [ some_other_condition -o ${diff_output} -o some_other_condition2 ]
then
....
fi

Basically, if they are the same ${diff_output} should contain nothing and the above test would evaluate to true.

But when I run my script, it says
[: too many arguments

On the if [....] line.

Any ideas?

© Stack Overflow or respective owner

Related posts about shell-scripting

Related posts about linux