Skip to content

Instantly share code, notes, and snippets.

@adamdoupe
Forked from anonymous/sshere
Created August 13, 2013 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamdoupe/6224872 to your computer and use it in GitHub Desktop.
Save adamdoupe/6224872 to your computer and use it in GitHub Desktop.
function sshere {
CURRENT=$(pwd)
[[ "$CURRENT" =~ ^"$HOME"(/|$) ]] && CURRENT="~${CURRENT#$HOME}"
ssh -t $@ "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