From 6b794373f2c0776e60f39952cfd7b0f9f41c9c4d Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Tue, 2 Jul 2019 22:13:18 +0100 Subject: [PATCH] Added colour to warning. Removed 'tput set AF' colour codes. --- .bash_logout | 4 ++-- .bashrc | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.bash_logout b/.bash_logout index 2e5c6a0..69c7a92 100644 --- a/.bash_logout +++ b/.bash_logout @@ -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 } } diff --git a/.bashrc b/.bashrc index 79420fa..1f9da64 100644 --- a/.bashrc +++ b/.bashrc @@ -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 }