Skip to content

Instantly share code, notes, and snippets.

@ochoarobert1
Created July 27, 2023 15:52
Show Gist options
  • Save ochoarobert1/35f2cd4d3d08ca76652a37d6ecd67c36 to your computer and use it in GitHub Desktop.
Save ochoarobert1/35f2cd4d3d08ca76652a37d6ecd67c36 to your computer and use it in GitHub Desktop.
bashrc template
# Adding OhMyPosh Styling
eval "$(oh-my-posh init bash --config ~/AppData/Local/Programs/oh-my-posh/themes/tonybaloney.omp.json)"
# Start SSH Agent
#----------------------------
SSH_ENV="$HOME/.ssh/environment"
function run_ssh_env {
. "${SSH_ENV}" > /dev/null
}
function start_ssh_agent {
echo "Initializing new SSH agent..."
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo "SSH Activated"
chmod 600 "${SSH_ENV}"
run_ssh_env;
echo $PWD
if [[ $PWD == *somedir* ]]; then
echo "Adding somedir Key"
ssh-add ~/.ssh/somedir;
else
echo "Adding main Key"
ssh-add ~/.ssh/main;
fi
}
if [ -f "${SSH_ENV}" ]; then
run_ssh_env;
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_ssh_agent;
}
else
start_ssh_agent;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment