Merge branch 'master' into laptop
This commit is contained in:
		
						commit
						209c9fe5c8
					
				|  | @ -1,6 +1,19 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| CHILD_PID=$(pgrep -P $1) | CHILD_PID=$(pgrep -P $1) | ||||||
|  | GRAND_CHILD_PID=$(pgrep -P $CHILD_PID) | ||||||
|  | 
 | ||||||
|  | if [ $? == 0 ] | ||||||
|  | then | ||||||
|  |     PROCESS=$(ps -p $GRAND_CHILD_PID -o comm=) | ||||||
|  |     COMMAND=$(ps -p $GRAND_CHILD_PID -o args --no-headers) | ||||||
|  |     if [ $PROCESS == "ssh" ] | ||||||
|  |     then | ||||||
|  |         PORT=$(ss -tnpa | grep ssh | grep "pid=$GRAND_CHILD_PID" | awk '{ print $4 }' | grep -o '[0-9]*$') | ||||||
|  |         alacritty -e $COMMAND -t "cd \$(readlink -e /proc/\$(cat /tmp/ssh_session_$PORT)/cwd); zsh --login" | ||||||
|  |         exit 0 | ||||||
|  |     fi | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| pushd "/proc/$CHILD_PID/cwd" | pushd "/proc/$CHILD_PID/cwd" | ||||||
| SHELL_CWD=$(pwd -P) | SHELL_CWD=$(pwd -P) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue