Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zsh function to allow ssh'ing direct to a directory
ssh() {
# If we specify host:dir, ssh straight to that dir
if [[ $1 =~ "(.*):(.*)" ]]; then
host=${match[-2]}
path=${match[-1]}
/usr/bin/ssh -t $host "cd ${path} && exec ${SHELL}"
else
/usr/bin/ssh $*
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.