Ubuntu 15.04安装Beyond Compare并添加右键对比菜单

前端之家收集整理的这篇文章主要介绍了Ubuntu 15.04安装Beyond Compare并添加右键对比菜单前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

声明

郑重声明:博文为原创内容,可以转载或引用,但必须在明显位置标明原文作者和出处,未经同意不得擅自修改本文内容

博客地址:http://blog.csdn.net/luzhenrong45


软件环境

Ubuntu 15.04 x64
Beyond Compare 64位 下载链接:带注册码及右键菜单脚本

安装32位兼容库(ia32-libs)

在Ubuntu系统上面安装Beyond Compare,需要32位兼容库的支持,即ia32-libs。在Ubuntu 13.10以前的系统,安装32位兼容库很方便:

sudo apt-get install ia32-libs

但在Ubuntu 13.10以及后续版本已经废弃了ia32-libs。在安装Beyond Compare的时候会提示需要安装ia32-libs:

system@(none):$ sudo dpkg -i bcompare-3.3.8.16340_amd64.deb
Unpacking bcompare (3.3.8-16340) ...
dpkg: dependency problems prevent configuration of bcompare:
 bcompare depends on ia32-libs; however:
  Package ia32-libs is not installed.

dpkg: error processing package bcompare (--install):

而安装ia32-libs的时候系统会提示安装包已经找不到:

system@(none):$ sudo apt-get install ia32-libs
sudo: unable to resolve host (none)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ia32-libs is not available,but is referred to by another package.
This may mean that the package is missing,has been obsoleted,or
is only available from another source
However the following packages replace it:
  lib32z1 lib32ncurses5 lib32bz2-1.0

因此,下面先解决Ubuntu 15.04系统上ia32-libs的安装问题:

sudo apt-get install libc6:i386

#切换到root权限
su

#进入apt源列表
cd /etc/apt/sources.list.d

#添加ubuntu 13.04的源,因为13.10的后续版本废弃了ia32-libs
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list

#更新源并安装ia32-libs
apt-get update
apt-get install ia32-libs

#删除ubuntu 13.04的源
rm /etc/apt/sources.list.d/ia32-libs-raring.list
apt-get update

exit

sudo apt-get install gcc-multilib

安装beyond compare

sudo dpkg -i bcompare-3.3.8.16340_amd64.deb

这样就可以安装成功了,通过bcompare命令或图标,即可启动beyond compare

添加右键菜单

安装beyond compare之后,如果想像windows系统那样, 选中文件后通过右键菜单启动beyond compare进行对比,也是可以的,做法如下:

  1. 新建3个脚本,compare,select_for_compare和compare_to_selected,内容分别如下:

    • [ compare ]
#!/bin/sh
quoted=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ",$1 }' | sed -e s#\"\"##)
bcompare $quoted
  • [ select_for_compare ]
#!/bin/sh
quoted=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ",$1 }' | sed -e s#\"\"##)
echo "$quoted" > $HOME/.beyondcompare/nautilus
  • [ compare_to_selected ]
#!/bin/sh
arg2=$(cat $HOME/.beyondcompare/nautilus)
arg1=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ",$1 }' | sed -e s#\"\"##)
bcompare $arg1 $arg2
  1. 将以上3个脚本拷贝到以下目录:
~/.local/share/nautilus/scripts

PS: ubuntu13.04以前的目录是放在 ~/.gnome2/nautilus-scripts/

这样,就可以选中对比文件后,通过 右键–> script –> compare 的方式启动beyond compare来对比文件了!


修改说明

作者 版本 修改时间 修改说明
WalkAloner V1.0 2017/11/27 第一版

猜你在找的Ubuntu相关文章