aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-08-22 19:15:56 +1200
committerTom Ryder <tom@sanctum.geek.nz>2015-08-22 19:15:56 +1200
commit37e1d75d0c51a2e8e947ae524e4e686e0a9eeffc (patch)
tree49df4863aef918a9d4e8b45a14ba0197195da8b2 /bash
parentUse simpler markup for README code block (diff)
downloaddotfiles-37e1d75d0c51a2e8e947ae524e4e686e0a9eeffc.tar.gz
dotfiles-37e1d75d0c51a2e8e947ae524e4e686e0a9eeffc.zip
Remove overkill chopping on BASH_VERSINFO[0]
Pointed out by Amy Grace.
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_logout2
-rw-r--r--bash/bash_profile2
-rw-r--r--bash/bashrc8
-rw-r--r--bash/bashrc.d/pass.bash2
-rw-r--r--bash/bashrc.d/prompt.bash2
-rw-r--r--bash/bashrc.d/vared.bash2
6 files changed, 9 insertions, 9 deletions
diff --git a/bash/bash_logout b/bash/bash_logout
index ac437add..f0985687 100644
--- a/bash/bash_logout
+++ b/bash/bash_logout
@@ -1,7 +1,7 @@
# Ensure we're using at least version 2.05
if ! [ -n "$BASH_VERSINFO" ] ; then
return
-elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} == 2)) && \
+elif ((BASH_VERSINFO[0] == 2)) && \
((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 4)) ; then
return
fi
diff --git a/bash/bash_profile b/bash/bash_profile
index 05b15693..1269492e 100644
--- a/bash/bash_profile
+++ b/bash/bash_profile
@@ -6,7 +6,7 @@ fi
# Ensure we're using at least version 2.05
if ! [ -n "$BASH_VERSINFO" ] ; then
return
-elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} == 2)) && \
+elif ((BASH_VERSINFO[0] == 2)) && \
((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then
return
fi
diff --git a/bash/bashrc b/bash/bashrc
index 17feeb06..a80d827d 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -1,7 +1,7 @@
# Ensure we're using at least version 2.05
if ! [ -n "$BASH_VERSINFO" ] ; then
return
-elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} == 2)) && \
+elif ((BASH_VERSINFO[0] == 2)) && \
((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) ; then
return
fi
@@ -77,7 +77,7 @@ shopt -s shift_verbose
shopt -u sourcepath
# These options only exist since Bash 4.0-alpha
-if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} >= 4)) ; then
+if ((BASH_VERSINFO[0] >= 4)) ; then
# Autocorrect fudged paths during completion
shopt -s dirspell
@@ -86,13 +86,13 @@ if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} >= 4)) ; then
# Warn me about stopped jobs when exiting; only if >=4.1 due to bug
# <https://lists.gnu.org/archive/html/bug-bash/2009-02/msg00176.html>
- if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} > 4)) || \
+ if ((BASH_VERSINFO[0] > 4)) || \
((10#${BASH_VERSINFO[1]%%[![:digit:]]*} >= 1)) ; then
shopt -s checkjobs
fi
# Expand variables in directory completion
- if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} > 4)) || \
+ if ((BASH_VERSINFO[0] > 4)) || \
((10#${BASH_VERSINFO[1]%%[![:digit:]]*} >= 3)) ; then
shopt -s direxpand
fi
diff --git a/bash/bashrc.d/pass.bash b/bash/bashrc.d/pass.bash
index d40a833f..8513e5dd 100644
--- a/bash/bashrc.d/pass.bash
+++ b/bash/bashrc.d/pass.bash
@@ -1,5 +1,5 @@
# Requires Bash >= 4.0 for dotglob, nullglob, and globstar
-if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} < 4)) ; then
+if ((BASH_VERSINFO[0] < 4)) ; then
return
fi
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 68c8eb37..e26460a4 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -26,7 +26,7 @@ prompt() {
PS1=$PS1'\$'
# If Bash 4.0 is available, trim very long paths in prompt
- if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} >= 4)) ; then
+ if ((BASH_VERSINFO[0] >= 4)) ; then
PROMPT_DIRTRIM=4
fi
diff --git a/bash/bashrc.d/vared.bash b/bash/bashrc.d/vared.bash
index e119319d..24ba0eac 100644
--- a/bash/bashrc.d/vared.bash
+++ b/bash/bashrc.d/vared.bash
@@ -1,5 +1,5 @@
# Requires Bash >= 4.0 for read -i and ${!name}
-if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} < 4)) ; then
+if ((BASH_VERSINFO[0] < 4)) ; then
return
fi