From 685234af1f48e976fd57ec04d4a253bcabfad4ea Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 21 Jun 2016 11:26:23 +1200 Subject: Remove unneeded linebreak backslashes Handy command: $ find bin sh bash -type f -exec grep \ -e '|| \\$' \ -e '&& \\$' \ -e '^\s*||' \ -e '^\s*&&' \ {} + --- bash/bash_logout | 2 +- bash/bash_profile | 2 +- bash/bashrc | 2 +- bash/bashrc.d/keep.bash | 6 ++---- bash/bashrc.d/path.bash | 3 +-- bash/bashrc.d/prompt.bash | 16 ++++++++-------- 6 files changed, 14 insertions(+), 17 deletions(-) (limited to 'bash') diff --git a/bash/bash_logout b/bash/bash_logout index da758588..e8137e55 100644 --- a/bash/bash_logout +++ b/bash/bash_logout @@ -3,7 +3,7 @@ # 2.05a). if ! [ -n "$BASH_VERSINFO" ] ; then return -elif ((BASH_VERSINFO[0] == 2)) && \ +elif ((BASH_VERSINFO[0] == 2)) && ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then return fi diff --git a/bash/bash_profile b/bash/bash_profile index 8f84597d..ee735720 100644 --- a/bash/bash_profile +++ b/bash/bash_profile @@ -8,7 +8,7 @@ fi # 2.05a). if ! [ -n "$BASH_VERSINFO" ] ; then return -elif ((BASH_VERSINFO[0] == 2)) && \ +elif ((BASH_VERSINFO[0] == 2)) && ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then return fi diff --git a/bash/bashrc b/bash/bashrc index 383273c3..facdd7eb 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -3,7 +3,7 @@ # 2.05a). if ! [ -n "$BASH_VERSINFO" ] ; then return -elif ((BASH_VERSINFO[0] == 2)) && \ +elif ((BASH_VERSINFO[0] == 2)) && ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then return fi diff --git a/bash/bashrc.d/keep.bash b/bash/bashrc.d/keep.bash index 28b3e8f7..c7e42e04 100644 --- a/bash/bashrc.d/keep.bash +++ b/bash/bashrc.d/keep.bash @@ -103,8 +103,7 @@ EOF # If -d was given, delete the keep files for the NAME if ((delete)) ; then - rm -- "$bashkeep"/"$name".bash \ - || ((errors++)) + rm -- "$bashkeep"/"$name".bash || ((errors++)) # Otherwise, attempt to create the keep file, using an # appropriate call to the declare builtin @@ -116,8 +115,7 @@ EOF *) declare -p -- "$name" ;; - esac ; } > "$bashkeep"/"$name".bash \ - || ((errors++)) + esac ; } > "$bashkeep"/"$name".bash || ((errors++)) fi ;; esac diff --git a/bash/bashrc.d/path.bash b/bash/bashrc.d/path.bash index d705b0ca..5f78e20e 100644 --- a/bash/bashrc.d/path.bash +++ b/bash/bashrc.d/path.bash @@ -225,8 +225,7 @@ _path() { IFS=: read -d '' -a promptarr < <(printf '%s\0' "$PATH") local part for part in "${promptarr[@]}" ; do - [[ $part == "${COMP_WORDS[COMP_CWORD]}"* ]] \ - || continue + [[ $part == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue COMPREPLY[${#COMPREPLY[@]}]=$(printf '%q\0' "$part") done ;; diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index eee81d95..6d90547f 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -53,10 +53,10 @@ prompt() { 256) format=$( { : "${PROMPT_COLOR:=10}" - tput AF "$PROMPT_COLOR" \ - || tput setaf "$PROMPT_COLOR" \ - || tput AF "$PROMPT_COLOR" 0 0 \ - || tput setaf "$PROMPT_COLOR" 0 0 + tput AF "$PROMPT_COLOR" || + tput setaf "$PROMPT_COLOR" || + tput AF "$PROMPT_COLOR" 0 0 || + tput setaf "$PROMPT_COLOR" 0 0 } 2>/dev/null ) ;; @@ -64,8 +64,8 @@ prompt() { 8) format=$( { : "${PROMPT_COLOR:=2}" - tput AF "$PROMPT_COLOR" \ - || tput setaf "$PROMPT_COLOR" + tput AF "$PROMPT_COLOR" || + tput setaf "$PROMPT_COLOR" tput md || tput bold } 2>/dev/null ) ;; @@ -104,8 +104,8 @@ prompt() { # Attempt to determine git branch, bail if we can't local branch branch=$( { - git symbolic-ref --quiet HEAD \ - || git rev-parse --short HEAD + git symbolic-ref --quiet HEAD || + git rev-parse --short HEAD } 2>/dev/null ) if [[ ! -n $branch ]] ; then return 1 -- cgit v1.2.3