Created
April 3, 2013 18:06
-
-
Save alexjs/5303641 to your computer and use it in GitHub Desktop.
zsh function to allow ssh'ing direct to a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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