#!/bin/bash function open_terminal { local URL="$1" if [ "${URL:0:5}" != "file:" ]; then zenity --error --title "Can't open terminal" --text "Terminal can only be opened for local filesystems" & fi local WORKING_DIR="${URL#file://}" if [ -d "$WORKING_DIR" ]; then WORKED="yes" gnome-terminal "--working-directory=$WORKING_DIR" & fi } WORKED="no" if [ "$NAUTILUS_SCRIPT_SELECTED_URIS" ]; then for I in "$@"; do open_terminal "$NAUTILUS_SCRIPT_CURRENT_URI/$I" done fi if [ "$WORKED" = "no" ]; then open_terminal "$NAUTILUS_SCRIPT_CURRENT_URI" fi exit 0