Created
October 9, 2018 16:46
-
-
Save bhaettasch/deb8af5b7f2566c317211ba7c9db8181 to your computer and use it in GitHub Desktop.
Automatically deploy your local bash aliases to a remote host on ssh connection
This file contains hidden or 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
# Autocompletion | |
complete -W "$(cat ~/.ssh/config | grep Host | awk '{ print $2 }')" ssh-a |
This file contains hidden or 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
#!/bin/bash | |
set -o errexit | |
set -o nounset | |
echo "Home sweet home - preparing" | |
scp ~/.bash_aliases "$1:.my_bash_aliases" >/dev/null | |
set +o errexit | |
ssh "$1" "grep 'source .my_bash_aliases' .bashrc || echo 'source .my_bash_aliases' >>.bashrc" >/dev/null | |
set -o errexit | |
ssh "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment