相关疑难解决方法(0)

在Shell脚本中解析Diff的结果

我想比较两个文件,看看它们在我的shell脚本中是否相同,我的方法是:

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

if [ some_other_condition -o ${diff_output} -o some_other_condition2 ]
then
....
fi
Run Code Online (Sandbox Code Playgroud)

基本上,如果它们是相同的$ {diff_output}应该什么都不包含,上面的测试将评估为true.

但是当我运行我的脚本时,它会说
[:太多的论点

在if [....]行.

有任何想法吗?

linux bash shell

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

bash ×1

linux ×1

shell ×1