mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 356cd01bd5ce71cd74ed6e7ab01a792d0cb337b9
parent a731dc952a42fb6d8fdb6f8c5af1ba8e19b1445f
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 31 Jan 2017 22:32:24 +0100

urxvtpwd: also ssh to current host

Diffstat:
urxvtpwd | 19+++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/urxvtpwd b/urxvtpwd @@ -22,12 +22,23 @@ 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 ' ') MYPWD2="${MYPWD/#\~/$HOME}" -if [ ! -z "$MYPWD2" -a -d "$MYPWD2" -a -r "$MYPWD2" -a -x "$MYPWD2" ] -then - exec $quoted_args -cd "$MYPWD2" +if [ -z "$MYHOST" ] +then + if [ ! -z "$MYPWD2" -a -d "$MYPWD2" -a -r "$MYPWD2" -a -x "$MYPWD2" ] + then + exec $quoted_args -cd "$MYPWD2" + else + exec $quoted_args + fi else - exec $quoted_args + if [ ! -z "$MYPWD2" -a -d "$MYPWD2" -a -r "$MYPWD2" -a -x "$MYPWD2" ] + then + exec $quoted_args -e ssh -t "$MYHOST" "cd \"$MYPWD2\"; zsh" + else + exec $quoted_args -e ssh -t "$MYHOST" + fi fi