by nitrofurano » Thu Oct 16, 2008 10:24 am
what for are them? nautilus-scripts are useful custom functionality you can have on right clicking on a file icon, and from a .sh, .py, .pl, etc. script, you can perform useful tasks, like opening the same directory as root, calculating md5sum, open the terminal from the directory, changing chmod or chown, convert comicbooks to pdf, etc.
for example:
#!/bin/sh
# open terminal here - Chris Picton, Martin Enlund, Christophe Combelles - GPL
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"
or:
#!/bin/sh
# root-nautilus-here - Shane T. Mueller, Doug Nordwall, Keith "penguingurus.com" - GPL
foo=`gksudo -u root -k -m "enter your password for nautilus root access" /bin/echo "got r00t?"`
sudo nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI
these scripts, for working, should be at '~/.gnome2/nautilus-scripts'