The file browser in Ubuntu provides the ability to run scripts on a selected file. These scripts can be used to do anything from opening a file to zipping or uploading, or anything that you can do from the command line.
Ubuntu中的文件浏览器提供了在选定文件上运行脚本的功能。 这些脚本可用于执行从打开文件到压缩或上载的任何操作,或者可从命令行执行的任何操作。
To start off, we will need to open a terminal window and type in the following command, which will create a new script file in our nautilus scripts directory
首先,我们需要打开一个终端窗口并键入以下命令,这将在我们的nautilus脚本目录中创建一个新的脚本文件。
gedit ~/.gnome2/nautilus-scripts/Open\ with\ gedit
gedit〜/ .gnome2 / nautilus-scripts / Open \ with \ gedit
Paste in the following script, found on the G-Scripts site, which is a great resource for finding scripts.
粘贴以下脚本,该脚本位于G-Scripts网站上 ,这是查找脚本的绝佳资源。
#!/bin/bash## Nautilus script -> open gedit## Owner : Largey Patrick from Switzerland# patrick.largey@nazeman.org# www.nazeman.org## Licence : GNU GPL ## Copyright (C) Nazeman## Ver. 0.9-1 Date: 16.02.2002# Add multiple file open in the same windows## Ver: 0.9 Date: 27.10.2001# Initial release## Dependence : Nautilus (of course)# Gnome-utils (gdialog)#filesall=””while [ $# -gt 0 ]dofiles=`echo “$1” | sed ‘s/ /\?/g’`filesall=”$files $filesall”shiftdonegedit $filesall&
#!/ bin / bash ## Nautilus脚本-> open gedit ##所有者:来自瑞士的Largey Patrick#patrick.largey@nazeman.org# www.nazeman.org ##许可证:GNU GPL ##版权所有(C)Nazeman# #版本 0.9-1日期:2002年2月16日#添加在同一窗口中打开的多个文件##版本:0.9日期:27.10.2001#初始版本##依赖关系:Nautilus(当然)#Gnome-utils(gdialog)#filesall =” ”而[[$#-gt 0] dofiles =`echo“ $ 1” | sed's / / \?/ g'`filesall =” $ files $ filesall” shiftdonegedit $ filesall&
Save and close the gedit window, and then execute the following command to make the script executable:
保存并关闭gedit窗口,然后执行以下命令以使脚本可执行:
chmod u+x ~/.gnome2/nautilus-scripts/Open\ with\ gedit
chmod u + x〜/ .gnome2 / nautilus-scripts / Open \ with \ gedit
Note that tab completion really helps here =)
请注意,制表符补全确实对这里有帮助=)
Now when you right click a file, you should see this:
现在,当您右键单击文件时,应该看到以下内容:
![](https://i-blog.csdnimg.cn/blog_migrate/1f87bb4b4977a1b7683b736f1e4a80a9.png)
Tested on: Ubuntu Dapper, Ubuntu Edgy Eft
经过测试:Ubuntu Dapper,Ubuntu Edgy Eft
翻译自: https://www.howtogeek.com/howto/ubuntu/add-open-with-gedit-to-the-right-click-menu-in-ubuntu/