Skip to content

Instantly share code, notes, and snippets.


Created Jul 16, 2013
What would you like to do?
Simple wrapper for ssh to ssh into a server and cd to the current directory in the local machine.
function sshere {
[[ "$CURRENT" =~ ^"$HOME"(/|$) ]] && CURRENT="~${CURRENT#$HOME}"
ssh -t ${1} "if [ -d $CURRENT ]; then cd $CURRENT; fi; exec \$SHELL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment