Sync .bashrc.

This commit is contained in:
Darren 'Tadgy' Austin 2023-09-30 12:15:50 +01:00
commit a97cdb9d10

View file

@ -199,14 +199,18 @@ __ssh_agent_prompt_command() {
# Find a new socket to use.
if __find_ssh_agent_sock; then
printf "\\033[1;33;40m%s\\033[0;39m\\n" "Connected to existing ssh-agent socket."
sleep 0.5
else
# Start a new agent.
eval "$(ssh-agent -s 2>/dev/null | grep -v 'echo'; printf "%s" "ERR=${PIPESTATUS[0]}")"
(( ERR > 0 )) && {
printf "\\033[1;31;40m%s\\033[0;39m\\n" "Failed to start new ssh-agent - continuing with no agent."
sleep 0.5
return 1
}
printf "\\033[1;32;40m%s\\033[0;39m\\n" "Started new ssh-agent."
__write_ssh_agents
sleep 0.5
fi
}
return 0
@ -283,6 +287,7 @@ hash grep >/dev/null 2>&1 && {
hash nc >/dev/null 2>&1 && alias pastebin='nc termbin.com 9999'
# Auto start the ssh agent and add keys for scp/sftp/ssh.
__ssh_agent_prompt_command
hash scp ssh ssh-add >/dev/null 2>&1 && alias scp='_EXEC=scp ssh'
hash sftp ssh ssh-add >/dev/null 2>&1 && alias sftp='_EXEC=sftp ssh'
hash ssh ssh-add >/dev/null 2>&1 && ssh() {