Skip to content

Commit 7e1f8bd

Browse files
authored
add xdg ssh wrapper
1 parent ba40d69 commit 7e1f8bd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Local/scripts/tools/ssh-wrapper.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
# This script must be symlinked in PATH as ssh for it to work
3+
# You also need add UserKnownHostsFile in your ssh config to point to the
4+
# new path where the ssh config is located, for example:
5+
# UserKnownHostsFile ~/Local/config/ssh/known_hosts
6+
7+
CURRENTDIR="$(cd "${0%/*}" && echo "$PWD")"
8+
CONFIGDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
9+
10+
PATH="$(echo "$PATH" | sed "s|$CURRENTDIR:||g; s|:$CURRENTDIR||g")"
11+
export PATH
12+
13+
if [ -f "$CONFIGDIR"/ssh/config ]; then
14+
set -- "-F" "$CONFIGDIR/ssh/config" "$@"
15+
fi
16+
17+
exec ssh "$@"
18+

0 commit comments

Comments
 (0)