Skip to content

Instantly share code, notes, and snippets.

@wyderkat
Forked from jonahbron/sshs.sh
Last active December 17, 2015 04:59
Show Gist options
  • Save wyderkat/5554856 to your computer and use it in GitHub Desktop.
Save wyderkat/5554856 to your computer and use it in GitHub Desktop.
# Wrapper for ssh to automatically source bash config file on remote machine.
# Sources ~/.bashrc
#
# Copyright Jonah Dahlquist
# License CC0
sshs() {
remote_rc="/tmp/.bashrc-$USER"
ssh ${*:1} ""
ssh -t ${*:1} "bash --rcfile $remote_rc ; rm $remote_rc"
# how to make it in one command???
# so password will be type in just one time
# Folowing return error:
# ssh -t ${*:1} "cat > $remote_rc; bash --rcfile $remote_rc ; rm $remote_rc" < ~/.bashrc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment