-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathterminal
executable file
·27 lines (24 loc) · 1008 Bytes
/
terminal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
#Open a terminal with the currentdir of nautilus as workdir.
#Don't need to select any file in the currentdir.
##########################################################################
# Nautilus "Terminal Here" Script #
##########################################################################
# #
# Created by Xinyu Du #
# Emails: [email protected] #
##########################################################################
if [ "$1" = "" ];then
wdir=${NAUTILUS_SCRIPT_CURRENT_URI#file://}
wdir=${wdir//%20/ }
else
filetype=$(file "$1")
filetype=${filetype##*: }
if [ "$filetype" = "directory" ];then
wdir=${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS%%$1*}
wdir=$wdir/$1
else
wdir=${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS%%$1*}
fi
fi
gnome-terminal --working-directory="$wdir"