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

前端之家收集整理的这篇文章主要介绍了Ubuntu 14.04 LTS Meld对比工具添加到右键菜单方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装Meld: sudoapt-getinstallmeld


添加到右键菜单方法

将两个脚本(set-as-Meld-leftcompare-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

脚本放置位置:



此时右键点击文件文件夹,右键菜单会出现"脚本--set-as-Meld-left 和 compare-to-left 及打开脚本文件夹"三项


使用方法

1.选中meld左侧想要对比的文件文件夹,然后选择"set-as-Meld-left"

2.再选中meld右侧想要对比的文件文件,然后选择"compare-to-left",此时Meld工具会自动打开




脚本

猜你在找的Ubuntu相关文章