Simple wrapper for ssh to ssh into a server and cd to the current directory in the local machine.
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
function sshere { | |
CURRENT=$(pwd) | |
[[ "$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