dotfiles/bin/rtramp

11 lines
305 B
Bash
Executable File

#!/bin/sh
if [ -S ~/.sshemacs -a -n "$SSH_CONNECTION" ]; then
for fn in "$@"; do
real=$(realpath "$fn" || echo "$fn")
printf "/ssh:%s@%s:%s\0" "$USER" "$(echo $SSH_CONNECTION | cut -d' ' -f3-4 | tr ' ' '#')" "$real"
done | xargs -0 emacsclient -s ~/.sshemacs
else
emacsclient -a '' "$@"
fi