commit a4ee98eea59eba52f8ebaed3009068a7817e549c
parent 3fd02f79b83d975928322a87ee75fcee7850d3f5
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 31 Jan 2017 23:58:57 +0100
no ssh to localhost or to bogus locations
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/urxvtpwd b/urxvtpwd
@@ -3,6 +3,8 @@
# run ARGV, with -cd FOLDER if FOLDER can be extracted from title of current
# window (see zsh config for how the title gets put in the window)
+CHOST=$(hostname | cut -d. -f1)
+
# http://superuser.com/a/403369/77814
quoted_args="$(printf " %q" "$@")"
@@ -23,9 +25,10 @@ fi
TITLE=$(xprop -id "$ID" | grep -m1 WM_NAME)
MYPWD=$(echo "$TITLE" | cut -d'$' -f1 | cut -d'"' -f2- | cut -d':' -f2-)
MYHOST=$(echo "$TITLE" | cut -d'$' -f1 | cut -d'"' -f2- | cut -d':' -f1 | tr -d ' ')
+MYCOLON=$(echo "$TITLE" | cut -d'$' -f1 | cut -d'"' -f2- | grep ':' | cut -b1)
MYPWD2="${MYPWD/#\~/$HOME}"
-if [ -z "$MYHOST" ]
+if [ -z "$MYHOST" -o "$MYCOLON" != ':' -o "$MYHOST" = "$CHOST" ]
then
if [ ! -z "$MYPWD2" -a -d "$MYPWD2" -a -r "$MYPWD2" -a -x "$MYPWD2" ]
then