Skip to content

Instantly share code, notes, and snippets.

@kristopolous
Last active September 9, 2024 00:16
Show Gist options
  • Save kristopolous/cac9c44db46d618caeb42b4114d39ed0 to your computer and use it in GitHub Desktop.
Save kristopolous/cac9c44db46d618caeb42b4114d39ed0 to your computer and use it in GitHub Desktop.
ssh slash enable
ssh() {
local _ssh="/usr/bin/ssh"
local n=""
[[ "$*" =~ \/ ]] || { $_ssh $*; return }
echo "$*" | tr "/" " " | rev | while read -d' ' i; do
i=$(echo "$i" | rev)
[[ -n "$n" ]] && n="\"$n"\"
n="$_ssh $i $n"
done
i=$(echo "$i" | rev)
eval "$_ssh -t $i $n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment