Last active
October 13, 2021 12:42
-
-
Save dovry/d038209acf0b090c384762d0a64f4829 to your computer and use it in GitHub Desktop.
General bashrc config I use to make life a little easier
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
alias bconf='vim $HOME/.bashrc && printf "\nReloading bashrc\n" && source $HOME/.bashrc' | |
export PATH="$PATH:$HOME/.local/bin/" | |
if shopt -q login_shell; then | |
printf "\nssh to these servers!\n\n" && grep -e "Host" /home/$(whoami)/.ssh/config | grep -v "Hostname" | grep -v "\*" | |
fi | |
eval `ssh-agent` > /dev/null 2>&1 | |
for possiblekey in ${HOME}/.ssh/*; do | |
if grep -q PRIVATE "$possiblekey"; then | |
ssh-add "$possiblekey" > /dev/null 2>&1 | |
fi | |
done | |
_ssh() | |
{ | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-) | |
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) | |
return 0 | |
} | |
complete -F _ssh ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment