From 415f6701c246363a463f828d24a86cb3e13488b6 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 6 Jun 2015 14:29:12 +1200 Subject: Avoid command substitution inline declaration --- bash/bashrc.d/grep.bash | 3 ++- bash/bashrc.d/ls.bash | 3 ++- bash/bashrc.d/prompt.bash | 6 ++++-- bash/bashrc.d/vr.bash | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'bash/bashrc.d') diff --git a/bash/bashrc.d/grep.bash b/bash/bashrc.d/grep.bash index 52570ea2..be201741 100644 --- a/bash/bashrc.d/grep.bash +++ b/bash/bashrc.d/grep.bash @@ -6,7 +6,8 @@ fi # Define function proper grep() { - local -i colors=$( { + local -i colors + colors=$( { tput Co || tput colors } 2>/dev/null ) if ((colors >= 8)) ; then diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash index 96593e33..31beb302 100644 --- a/bash/bashrc.d/ls.bash +++ b/bash/bashrc.d/ls.bash @@ -6,7 +6,8 @@ fi # Define function proper ls() { - local -i colors=$( { + local -i colors + colors=$( { tput Co || tput colors } 2>/dev/null ) if ((colors >= 8)) ; then diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 27cb9dd5..f4a1b718 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -22,10 +22,12 @@ prompt() { fi # Count available colors, reset, and format (decided shortly) - local -i colors=$( { + local -i colors + colors=$( { tput Co || tput colors } 2>/dev/null ) - local reset=$( { + local reset + reset=$( { tput me || tput sgr0 } 2>/dev/null ) local format diff --git a/bash/bashrc.d/vr.bash b/bash/bashrc.d/vr.bash index fc1de5ef..4289c15c 100644 --- a/bash/bashrc.d/vr.bash +++ b/bash/bashrc.d/vr.bash @@ -21,14 +21,16 @@ vr() { fi # Ask Git the top level - local git_root=$(cd -- "$path" && git rev-parse --show-toplevel 2>/dev/null) + local git_root + git_root=$(cd -- "$path" && git rev-parse --show-toplevel 2>/dev/null) if [[ -n $git_root ]] ; then cd -- "$git_root" return fi # Ask Mercurial the top level - local hg_root=$(cd -- "$path" && hg root 2>/dev/null) + local hg_root + hg_root=$(cd -- "$path" && hg root 2>/dev/null) if [[ -n $hg_root ]] ; then cd -- "$hg_root" return -- cgit v1.2.3