Added colour to warning. Removed 'tput set AF' colour codes.

This commit is contained in:
Darren 'Tadgy' Austin 2019-07-02 22:13:18 +01:00
commit 6b794373f2
2 changed files with 8 additions and 8 deletions

View file

@ -21,7 +21,7 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
[[ ! -z "$SSH_AUTH_SOCK" ]] && (( ${_SSH_AGENT_REG_FAILED:-0} == 0 )) && {
_lock_agents_file && {
_pop_agent_sock || {
echo -e "$(tput setaf 1 || tput AF 1)Failed to clean up agents file!$(tput op)"
echo -e "$(tput setaf 1)Failed to clean up agents file!$(tput op)"
_SLEEP=3
}
}
@ -32,7 +32,7 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
(( $SHLVL == 1 )) && {
[[ ! -z "$SSH_AGENT_PID" ]] && {
ssh-agent -k >/dev/null 2>&1 || {
echo -e "$(tput setaf 1 || tput AF 1)Failed to kill ssh-agent!$(tput op)"
echo -e "$(tput setaf 1)Failed to kill ssh-agent!$(tput op)"
_SLEEP=3
}
}

12
.bashrc
View file

@ -17,7 +17,7 @@ _agent_prompt_command() {
echo "Connected to alternate ssh-agent - you may need to re-add keys."
_SSH_AGENT_REG_FAILED=0
else
echo "Connected to, but failed to register, alternate ssh-agent - you may need to re-add keys."
echo "$(tput setaf 3)Connected to, but failed to register, alternate ssh-agent - you may need to re-add keys.$(tput op)"
_SSH_AGENT_REG_FAILED=1
fi
}
@ -26,13 +26,13 @@ _agent_prompt_command() {
else
if [[ -z "$(egrep -v '^$' ~/.ssh/agents)" ]]; then
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {
echo "$(tput setaf 1 || tput AF 1)Lost connection to ssh-agent - no alternate available!$(tput op)"
echo "$(tput setaf 1)Lost connection to ssh-agent - no alternate available!$(tput op)"
unset SSH_AUTH_SOCK
_SSH_PROMPT_ERROR_ISSUED=1
}
else
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {
echo "$(tput setaf 1 || tput AF 1)Lost connection to ssh-agent - failed to connect to new agent!$(tput op)"
echo "$(tput setaf 1)Lost connection to ssh-agent - failed to connect to new agent!$(tput op)"
unset SSH_AUTH_SOCK
_SSH_PROMPT_ERROR_ISSUED=1
}
@ -84,7 +84,7 @@ _lock_agents_file() {
if exec 9>~/.ssh/agents.lock && flock -E 10 -w 0.5 9; then
return 0
else
echo "$(tput setaf 1 || tput AF 1)Failed to obtain lockfile!$(tput op)"
echo "$(tput setaf 1)Failed to obtain lockfile!$(tput op)"
fi
elif [[ "$_PLATFORM" == "Darwin" ]]; then
# Do locking the sucky way on OSX.
@ -95,9 +95,9 @@ _lock_agents_file() {
sleep 0.1
fi
done
[[ "${_GOT_LOCK:-0}" == "0" ]] && echo "$(tput setaf 1 || tput AF 1)Failed to obtain lockfile!$(tput op)"
[[ "${_GOT_LOCK:-0}" == "0" ]] && echo "$(tput setaf 1)Failed to obtain lockfile!$(tput op)"
else
echo "$(tput setaf 1 || tput AF 1)File locking unsupported - skipping update of agents file!$(tput op)"
echo "$(tput setaf 1)File locking unsupported - skipping update of agents file!$(tput op)"
fi
return 1
}