红联Linux门户
Linux帮助

Ubuntu 14.04 LTS Meld对比工具添加到右键菜单方法

发布时间:2017-02-24 11:09:12来源:blog.csdn.net/yelangjueqi作者:ShyBoy天天向上
Ubuntu下安装Meld: sudo apt-get install meld 
 
添加到右键菜单方法:
将两个脚本(set-as-Meld-left 和compare-to-left)拷贝到 ~/.local/share/nautilus/scripts目录即可
 
PS: 这个脚本是在网上找到的。
 
set-as-Meld-left脚本内容:
#!/bin/bash  
#  
# This script opens a compare tool with selected files/directory by   
# script "set-as-*-left".  
# so you should run "set-as-*-left" first  
# Copyright (C) 2010  ReV Fycd  
# Distributed under the terms of GNU GPL version 2 or later  
#  
# Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts  
# or ~/.local/share/nautilus/scripts (ubuntu 14.04 LTS)  
# You need to be running Nautilus 1.0.3+ to use scripts.  
# You also need to install one compare tools to use scripts(such like meld)  
# You can change the $compareTool to other compare tools(like "Kdiff3") that   
# you have already installed before. 
compareTool="meld"  
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then  
set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS  
if [ $# -eq 1 ]; then  
file1="$1"  
echo "set-as-Meld-left Copyright (C) 2010  ReV Fycd"  
echo "${compareTool} ${file1} \\"> ~/.startcompare  
fi  
fi
 
compare-to-left 脚本内容:
#!/bin/bash  
#  
# This script opens a compare tool with selected files/directory by   
# script "set-as-*-left".  
# so you should run "set-as-*-left" first  
#  
# Copyright (C) 2010  ReV Fycd  
# Distributed under the terms of GNU GPL version 2 or later  
#  
# Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts  
# or ~/.local/share/nautilus/scripts (ubuntu 14.04 LTS)  
# You need to be running Nautilus 1.0.3+ to use scripts.  
# You also need to install one compare tools to use scripts(such like meld)
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then  
set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS  
fi  
if [ $# -eq 1 ]; then  
file2="$1"  
echo "Compare-to-left Copyright (C) 2010  ReV Fycd"  
echo $file2 >> ~/.startcompare  
fi
chmod +x ~/.startcompare  
exec ~/.startcompare
 
脚本放置位置:
Ubuntu 14.04 LTS Meld对比工具添加到右键菜单方法
此时右键点击文件或文件夹,右键菜单会出现"脚本--set-as-Meld-left 和 compare-to-left 及打开脚本文件夹"三项
 
使用方法:
1.选中meld左侧想要对比的文件或文件夹,然后选择"set-as-Meld-left"
2.再选中meld右侧想要对比的文件或文件夹,然后选择"compare-to-left",此时Meld工具会自动打开
Ubuntu 14.04 LTS Meld对比工具添加到右键菜单方法
脚本
 
本文永久更新地址:http://www.linuxdiyf.com/linux/28666.html