#!/bin/sh
# From Chris Picton
# Replaces a Script by Martin Enlund
# Modified to work with spaces in path by Christophe Combelles
# This script either opens in the current directory,
# or in the selected directory
base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"
if [ -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
dir="$base"
else
while [ ! -z "$1" -a ! -d "$base/$1" ]; do shift; done
dir="$base/$1"
fi
gnome-terminal --working-directory="$dir"
Using the gedit text editor, copy and save this shell script in a text file to your Nautilus script directory under ~/.gnome2/nautilus-scripts. Name the file something like openhere.sh.
A couple of tips, if you navigate to the scripts folder in Nautilus, from the menu select View -> Show Hidden Files, then the hidden folders, the folders that begin with a ".", can be seen. If you use the gedit text editor, when saving the script, right click in the file name area and from the drop down menu select Show Hidden Files, to show the hidden directories.
The script needs to be executable so do the following in a terminal window:
~$ cd .gnome2/nautilus-scripts
~/.gnome2/nautilus-scripts$ chmod +x openhere.sh
Now when right clicking in the file area of Nautilus, a menu drop down will appear. Select Scripts, then the name of the script to run, in this case openhere.sh, which will open a terminal window in the current directory.
No comments:
Post a Comment